We discuss some tools used for writing Java programs.
The minimum requirement for writing Java and running Java programs is the Java Development Kit. By searching for Java JDK, you will get this page.
By searching for Android ADT, we get this Android Developer's webpage. Download the zip file and extract. Run Eclipse from the eclipse subfolder.
When Eclipse is run, it will ask for a Workspace. Select any folder where files should be saved. Next, create a New Java Project.
We will use the name ex1 for the project name.
Creating a new Java file is the same as creating a new class. A Java program will have at least one class. The class will be named Ex1. The convention is that class names start with capital letters.
If you look at the Package Explorer on left of Eclipse, it should be this structure. The package name actually gives the folder structure. You may look at the Workspace in Explorer to see the structure. The only function of Ex1.java is to print “Hello World”. This program will be discussed in Tutorial 2.
package com.javaAndroid.ex1; public class Ex1 { public static void main (String[] args) { String hello = "Hello World!"; System.out.println(hello); } }
No comments:
Post a Comment