Implementing a Java Program?

Implementation of a  java  application  program involves  series of  steps. They  include

1.    Creating  a  program.

2.    Compiling  the  program.

3.    Running   the  program.

Creating  the  program :-

 We  can  create  a  program  using  any text editor.Assume   that  we have  entered the  following.

class  Test
{
 public  static  void  main  (String  args[])
{

System. Out. println (“  Hellow”);
System .Out . println (“ welcome to the  world  of  JAVA”);
}

}

We must save  this  program  in a  file  called   Test. java.

This  file  are called  the  source file. Note  that  all java  source  files  will have the  extention “java” .if  a program  contains  multiple classes, the file name  must  be  the  class  name  of  the  class  containing   the main method.

Compiling   the program:-

To  compile  the program  we must  run  the java compiler  java c  with the  name  of  the source file  on the  commend   line as  shown below.

javac Test . java

If  every thing  are ok the java c compiler creates  a file called  Test.class containing  the byte code of  the program. Note that the compiler automatically names the byte code file as .class.

Running the Program:

 we need to use the java interpreter to run a stand alone program.At the  command  prompt  type  

java Test

Now the interpreter  looks  for  the  main  method  in the  program  and  begins  execution from  there.When executed  our  program  displays  the  following output:

Hellow

Welcome  to  the world of  JAVA.
 

Related

Java 8533385810136065599

Post a Comment

emo-but-icon

item