How to Write Java
A
Simple Java Program Let's now create a simple Java program using text editor
called Notepad. First of all, put some Java code into the editor such as
Notepad to create our first Java program, as shown in the following code
snippet: below
class Simple
{
public static void
main(String args[] )
{
system.out.println("Hello
world");
}
}
In
the above code snippet, the class keyword is used to declare a class
called Simple. The name Simple is used as an identifier, which is used
to give an appropriate name to a Let's take a look at the following line:
This
is the line at which the program begins executing. It is by calling this main 0
method that all Java programs begin their execution. The line begins with
public keyword which is an access specifier, making the main I method
accessible outside the class in which it is declared. Static keyword allows main to exist before creating object of
the class in which the main method
is declared. void keyword specify
that the main ( ) does not return
any value. Java to a desired location on your system. Java programs are saved
with the file extension '.java’. It is to be noted that in Java, name of the
file should match with name of the class.
Java is a case-sensitive language, that is the word 'hello' and 'Hello' have
two different meanings in Java. Once a Java program is written, its time to
compile and then run it to show the desired output.
Compiling and Running the Program: To
run a Java program, it is necessary to compile it first using Java compiler.
This Java compiler is an application named javac.exe
located in the Java directory bin folder.
For more understanding you can also read below mentioned topic
from online:
java 2 programs with a graphical user interface
0 Comments
if you have any doubts ,please let me know