Friday, March 15, 2019

JAVA DUMPS

public static void main (String args []) 
1.The public keyword is an access specifies, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared. In this case, main ( ) must be declared as public. 
2.The keyword static allows main ( ) to be called without having to instantiate a particular instance of the class.This is necessary since main ( ) is called by the Java interpreter before any objects are made. 
3.The keyword void simply tells the compiler that main ( ) does not return a value. 
4.Main ( ) is the method, called when a Java application begins. 
5.String args [ ] declares a parameter named args, which is an array of instances of the class String. In this case, 
args receives any command-line arguments present when the program is executed. 
7.With the same name as args we can?t define one more variable we will get CTE. 
8.PSVM (String [] p) p is a variable which is defined as a identifier. 

System.out.println ("This is a simple Java program."); 
1.System is a predefined class that provides access to the system which is introduced inside java.lang package. 
System class is a default class. 
2.Out is the static attribute which is calling print method. Out is a static attribute inside a system class. 
3.Out is a data type of print stream class that is connected to the console. 
4.Out is a static attribute. Method System.out.println displays its argument in the command window followed by 
a new-line character to position the output cursor to the beginning of the next line. 
5.Println ( ) displays the string which is passed to it. 
6.System.out.printf method (f means "formatted") displays formatted data inside a print stream class there is 
Println method & printf method is available. 
7.Notice that the Println ( ) statement ends with a semicolon. All statements in Java end with a semicolon..

How to set path in Java

The path is required to be set for using tools such as javac, java, etc.
However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.


There are two ways to set the path in Java:  

  1. Temporary
  2. Permanent
1) How to set the Temporary Path of JDK in Windows

  • Open the command prompt
  • Copy the path of the JDK/bin directory
  • Write in command prompt: set path=copied_path

For Example:

set path=C:\Program Files\Java\jdk1.6.0_23\bin