Home >Java >javaTutorial >core java -Basics
Today We learn about Some important topics are you excited
java Class is Divided into 2 types:
1)Predefined Class
2)User defined class
Every java Predefined Class always start with CAPITAL LETTERS
[EX: System, String...etc]
Java user defined Classes start with Both SMALL and CAPITAL LETTERS
It is highly advisable to start a java class name with CAPITAL LETTER.
java Method is Divided into 2 types:
1)Predefined Method
2)User defined Method
Every Java Predefined Method always starts with a Small letter.
Every Java user defined Method Can starts with Both Small letters and Capital letters.
Note: Predefined Method, User defined Method again divided into 2 types Parameterized Method and Non-Parameterized Method.
Main() is a Parameterized Method ,in 1 Parameter ,Type is String Array.
Inside a Parentheses we could write Parameters or Arguments.
Example:
public class ClassA
{
void Meth1(int i) //parameterized method
{
System.out.println("Meth1() Called");
System.out.println("i value:" +i);
}
void Meth2(int i,String S, char C) //parameterized method
{
System.out.println("Meth2() Called");
System.out.println(i-99);
System.out.println(S);
System.out.println(C);
}
public static void main(String[] args)
{
ClassA aobj=new ClassA();
aobj.Meth1(99);
System.out.println("-------------------");
aobj.Meth2(100,"Hello",'X');
}
}
OUTPUT:
Meth1() Called
i value:100
Meth2() Called
1
Hello
X
Important Question for Interview Purpose
Q)What happens internally whenever we are compiling and running a java program?
A: When ever we are Compiling our java Program with the help of the Command Javac Filename.java , java compiler is going to compile our java program. After Successful Compilation it is going to generate a .Class file. The generated .class file Consists of byte code instructions which cant be understandable by the humans. Those byte code instructions can be understandable only by the machines. in our scenerio that machine is JVM. In order to run our java program we need to provide the generated .Class file as an input of the jvm with the help of command java generated .class file name jvm is going to check whether all the byte code instructions present in that .Class file are correct or wrong ,if correct we will be getting the output. If Wrong We will getting an exception.
Waiting for Day-5------------------------------------------------------
The above is the detailed content of core java -Basics. For more information, please follow other related articles on the PHP Chinese website!