John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Language Basics

View previous topic View next topic Go down 
AuthorMessage
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: Language Basics   Sat Oct 20, 2012 9:28 am

Language Basics

Create your first Java program

Let's start by compiling and running the following short sample program.
________________

/*
This is a simple Java program. Call this file "progname.java".
*/


public class progname {
// Your program begins with a call to main().
public static void main(String args[]) {
System.out.println("Java.");
}
}

Code:
/*
 This is a simple Java program. Call this file "progname.java".
 */

public class progname {
  // Your program begins with a call to main().
  public static void main(String args[]) {
    System.out.println("Java.");
      }
}

In Java, a source file is called a compilation unit. It is a text file that contains one or more class definitions. The Java compiler requires that a source file use the .java filename extension.

In Java, all code must reside inside a class. By convention, the name of the public class should match the its file name. And Java is case-sensitive.


For further explanation...

Arrow Open a text editor software, don't worry notepad will do.
Arrow Select all of the code then Paste the it in notepad.
Arrow Save it with a file name of progname.java (NOTE: progname.java is used as the file name because the class name must be the same with the file name)
Arrow Then compile the program. Follow it Click Here!



Code:

/*
 This is a simple Java program. Call this file "progname.java".
 */

public class progname {
//the class name is progname, so save it as progname.java

  // Your program begins with a call to main().
  public static void main(String args[]) {
//The code here will be executed when you start the program, this will be the place in inserting syntax
    System.out.println("Java.");
//Displays an output - Java
      }
}
Back to top Go down
View user profile http://delmark.meabout.com
 
Language Basics
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: