Skip to content

Categories:

Lab 0

Lab Description:

This lab opens the doors to introducing Java and its compiler Eclipse by creating 
the "Hello World" program. All or most languages carry the same concepts in terms 
of the functions that are being used, such as loops and even if statements. However, 
every language has its own rules, or syntax, for creating those functions. Aside 
from knowing the syntax of the language, organization is an important part of 
programming in any language and should be maintained at all times. It won't matter 
if the program is organized or not won’t matter to the program itself or the compiler 
as along as the syntax is correct. However, other people who look at the code need to 
be able to understand it by using indentations, spaces, and even bracket positioning. 
This of course is not only for someone else, but yourself in case you need to refer 
back to the code to be able to understand it easier. By doing this lab, we will be 
able to take the first steps towards learning Java, its syntax, and good organization.

This simple program was written by not only using the correct syntax, but also with
a good convention of organization. Everything is aligned and tabbed so that it the
program is readable. The main part of the program which prints "Hello World" is 
commented to signify its main purpose. The curly brackets are also aligned as well to 
show what part of the program belongs to main. There were no problems in this lab 
except for the transition from the syntax of previous languages learned to this one.

Code:

package labs;
public class Helloworld {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Hello World"); //prints string "Hello World"
	}

}

Screenshots:

Program Output

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.