Showing posts with label Java 1. Show all posts
Showing posts with label Java 1. Show all posts

You can try the following using NetBean or notepad :

Java Introduction 1

public class Welcome{
public static void main (String args[]) {
System.out.print( "welcome to ") ; System.out.println ("Java Programming!") ;

}
}

Java Introduction 2

public class Welcome2 {
public static void main (String args[]) {
System.out.println( "welcome\nto\njava\nprogramming!") ;

}
}


Java Introduction 3

public class Ex {
public static void main (String a []) {
System.out.println( "#\n###\n####");

}
}

The first step of java programming is to learn print out a statement.
Using Notepad or Netbeans.

public class Welcome1
{
public static void main( String args[] )
{
System.out.print( "Welcome to Java Programming!" );

} // end method main

} // end class Welcome1

NOTE: Save it as Welcome1.java

Now you can execute this using CMD. Use Run and type cmd.
Now you need to compile the file.
Locate your file by using " cd .."
Type javac Welcome1.java to compile.
If no syntax error, den type java Welcome1 .
It will show:
Welcome to Java Programming!