Java4teachus

Wednesday, January 09, 2019

Structure Of a Java Program


The standard format released by language developers and which is followed by the language programmers for developing the real world application is called 'Structure of a Program'.

Structure-Of-a-Java-Program.jpeg

Syntax:

package Information;
class <Class Name>
{
Data Members ;
Methods ;
public static void main(String args[])
{
Block of Statement's
}
}

Explanation 


1) Package Information:  represents collection of  'classes, interfaces & sub packages'. For each sub package contain's collection of classes, interfaces and sub-sub packages etc . If we use predefined of any class interfaces as a part of java program and whose specify the classes & interfaces presents (Other wise we get compile time error's). Out of many packages in java , One of the package is " Java.lang.* " is a default package directly imported for each & every java program . Hence this package is as called " Default package ".

2) Each & every java programmer must be start with the concept of a class . A class is a keyword used for development of  "Programmer Defined Data Type " . 
      
           Ex : - Student  S = new Student( );

3) <class name> is one of the Java Valid Variable Name is treated as a name of the  keyword and it is pro-grammatically consider as " Programmer Defined Data Type ".

4) Data Members represents the either " Instance " or " Static " and that are selected based on the class name.

5) Programmer defined method represents " Instance " or "Static" and meant  for performing different type of operations either repeatedly or only once.

6)  Since each & every java program executes starts from "main(String args[])" and it is called as program drivers. (pro-grammatically it is consider as "Sou-do" method whose information within  java compiler & JVM ).

7)  Since "public static void main(String args[])" method of java execute only once and hence its nature must be "Static".

8)  Since "public static void main(String args[])" method of java can be used by java programmer in any class and hence its access modifier must be "Public".

9) Each & every "public static void main(String args[])" method of java takes  in the form of  "Array Of Object Of String Class" ( String args[] ). 

10) "Block of statements or Set of executable statements", which are internally calling programmer defined method either with object or respect to class.

11)  The file name of a java program is that whatever class name contain main method then the class name must be given with an extension ".java". 


Q . Write a Java program which will display the "Hello World" message ? 

program:

class Sample
{
public static void main(String args[])
{
System.out.println("Hello World");
System.out.println("This is First Program");
System.out.println("BY Java4TeachUs.blogspot.com");
}
}


steps-for-compiling-the-java-program.jpeg


➪Steps for compiling the java program:

The following steps sequence will compile and execute the java program.
  • Write the source code and save it on same file name with an extension called ".java".
          Ex:- Sample.java
  • Compile the java program as follows. 
          Syntax :            javac Sample.java
          Example :        javac Sample.java
  • Is there any error's then find the error's & solve and save the program.
  • If there is no error's are not found .
  • Then java compiler generates on intermediate file with an extends called "class".
          Ex:-Sum.class
  • Finally execute the java program as like this.
          Ex:- java Sum


Get the executable program and output will be shown as below .

Sample-Program.java


The above diagram "Java Javac" are two tools (or) application programs (or) executable files developed by sun micro system developers and available as a part of Java/bin/direction (or) folders and they are used for compiling & executing the Java program executable.

Requirement Analysis for development of Java application.

 1) Software Requirement : Download JDK  1.5 / 1.6 / 1.7 / 1.8
                                                          (Freely download from www.sun.com)
 2) O.S  Requirement         : Any O.S.can be used because Java is plod form independent.
 3) IDE  Requirement        : (Integrated Development Environment)


An IDE is one of the third party developed by third party members which is released to real world and used by each & every programmer for development real world application of obtaining of solve in built facilities.

EX:- 1) DOS Editor
             Note pad(poor IDE)
             word pad etc
         2) Edit plus (- ES Enterprises } Best for learners
         3) Net beans (Best IDE'S)
             My Eclipse
          
In the above IDE are mostly commonly Used in real industry for developing the real time applications .

2 comments:

Thanks for visiting my site..