write hello world in java by ruchin panchal

Steps
  1. 1
    Navigate to www.java.sun.com and download the Java JDK or Java SE, not JRE (Java Runtime Environment). Once its downloaded, install it. Then restart the computer.
    Ads by Google
    Google is Hiring
    C, C++, Python, Perl, Java Experts Openings in London. Apply now!
    www.google.co.uk/jobs
  2. 2
    Open the text editor and write the following code:
    public class HelloWorld{
              public static void main(String[] args){
                   System.out.println("Hello World!");
              }
         }
  3. 3
    Save this code as HelloWorld.java. In Windows, make sure you choose the "all files" option from the file type drop down list box, otherwise it will be saved as a text file and not a .java file.
  4. 4
    Click start > run and type command or cmd (try each and see which one works for your operating system).
  5. 5
    From the command prompt, drill down to the folder where you saved the HelloWorld.java file. (type "cd <name
  1. ou can use tab for auto completion)
  2. 6
    Type the following: javac HelloWorld.java and press Enter. You should see that after thinking for a while the computer returns to the command prompt.
  3. 7
    Type "java HelloWorld" (no quotes) and see what happens. You should see the text "Hello World" displayed on the monitor right below where you issued the java HelloWorld command.
    Ads by Google
    Protect Software
    Price, Package & License Software How Customers Demand. Free Webinar
    www.flexerasoftware.com
    Google is Hiring
    C, C++, Python, Perl, Java Experts Openings in London. Apply now!
    www.google.co.uk/jobs
edit Things You'll Need
  • Java Development Kit (can be downloaded from Sun Microsystems site for free). Note that for different operating systems there are different JDK's (JDK is a set of tools created by Sun to assist programmers with writing software using Java)
  • Text editor -- for Windows, use notepad; for linux you can use VI or emacs
edit Tips
  • Java is case sensitive. Remember this.
  • If you don't have administrator privileges on the computer you're trying to install the SDK on, start the installer and when you get to a part of the install with a checkbox asking if you want to add the SDK to the environment variables, uncheck it. It should install properly after that. The only downside is that you can't compile java programs by typing javac in cmd prompt, you have to use a program like Eclipse, NetBeans, or JCreator. So download and install your choice SDK (Software Development Kit). Then it should ask you to specify where your java SDK or Java SE is installed, specify where the program java.exe is, so find that in your C:\Program Files\JDK\jdk\ directory. Then you're ready to go!


0 comments:

Post a Comment

 
© 2011 HOW TO .
Content License | Recode by Ruchin panchal Only Android Developers