eHow launches Android app: Get the best of eHow on the go.

How To

How to Get Started Writing Computer Programs

Contributor
By Jackson Lewis
eHow Contributing Writer
(0 Ratings)
Get Started Writing Computer Programs
Get Started Writing Computer Programs

Getting started writing computer programs can appear at first to be a challenging task. If you have never programmed before but have taken a class in a foreign language, you can think of computer programming in a parallel light. You start by choosing a language to learn and setting up an environment in which to do so. Then you start with basic skills and slowly build upon them until you can accomplish complex programming tasks. In the last decade, object-oriented languages have become more popular in schools that teach introductory programming because of the advanced skills that can be developed in a faster time frame. Java is a popular programming language to use to write your first computer program.

From Quick Guide: All About Java Programming
Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • Internet access
  • Administrator access to your computer
  1. Step 1

    Download the latest Java software developer's kit from Sun Microsystems and install it on your computer.

  2. Step 2

    Open a text editor for writing your first program. All Java program source code is saved with the default file extension .java. Save the blank document as myFirstProgram.java

  3. Step 3

    The first program that most students learn in any program is called "Hello World." The primary purpose of the Hello World program is to ensure that the student can create a basic program in the language being taught and display the words "Hello World" to the console or screen of the development computer. To create "Hello World" in Java, type the following code into the text editor and save the file.

    class myFirstProgram

    {

    public static void main (String[] args)

    {

    System.out.println("This is my first computer Program! Hello World!");

    } // end of the main method

    }// end of class myFirstProgram

  4. Step 4

    Open your command prompt on a Windows computer by selecting the Start->Command menus and enter the letters "cmd" or "command" to open the command prompt. Change the directory to where you saved the myFirstProgram.java file. Type the command "javac myFirstProgram.java" and hit the "enter" key. This will create the byte code that will be run in a new file called myFirstProgram.class.

  5. Step 5

    Run the new Java program by typing "java myFirstProgram.class" on the command line. The following output will be displayed at the command prompt: "This is my first computer Program! Hello World!" and your first computer program is complete.

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics