Introduction to Java
Java is an object-oriented programming language developed by Sum Microsystems in1991.
It was originally called oak by James Goslin(one of the inventors of Java.
JAVA = purely object-oriented
--------------------------------------------------------------------------------------------------------------------------------
How java works
Java is compiled into bytecode and then it is interpreted into machine code.
source code compiled bytecode interpreted to machine code for given to the machine.
-----------------------------------------------------------------------------------------------------------------------------
Java installation
go to google and type "install JDK" >> install Java JDK
go to google and type "install IntelliJ idea" >>install Java IDE (community version)
JDK >> java development kit =collection of tools used in developing and running java programs
JRE >>java runtime environment =helps in executing programs developed in java
-----------------------------------------------------------------------------------------------------------------------------
Basic Structure of a Java Program
package Com.Company; ---> groups classes!
public class Main{
public static void Main (String [] args){
System.out.println("Hello World");
}
}
-----------------------------------------------------------------------------------------------------------------------------
Naming Conventions
>>for classes
we use the Pascal convention. First and subsequent characters from a word are capital lattes (uppercase)
example: Main, MyScanner, MyEmployee, CodeWithHarry
>>for functions and variables
we use the camelCase Convention. Here the first character is lowercase and the subsequent character is uppercase like below.
main, myScanner, myMarks,codeWithHarry
Comments
Post a Comment