Java
Java
1) JDK/java===jdk11
2) IDE(eclipse, intellijide etc)
1. Install JDK.
a) Signup and download jdk. https://www.oracle.com/in/java/technologies/downloads/
Once install JDK then we have to set Java path.
A) This PC->C:\Program Files\Java\jdk-24\bin (copy this path) and.
B) Search environment variable->select “Edit the system environment variable”->click on
“environment variable”->Under “System Variable->select “path” and click “Edit”->New->paste the
path “C:\Program Files\Java\jdk-24\bin” and click “Ok” for all.
b) For test, open terminal/command promt, type Java -version, it will list the version details.
Main Method:
1. Highlighted one is main method.
2. If you want to execute the class, main method must be there. We cant run the program
without main method.
package day1;
package day1;
Output:
Rules:
1) Class name should start with uppercase.
2) Class name should not start with number.
3) Class name contain _(UnderScore) but not hypen (-)
4) Special characters are not allowed.
5) Class name contains number/s.
Comments:
1) Single line comments //---java will not execute.
2) Multi line comments. Paragrah type comments /*paragraph*/
Variable
A variable is a container we can store some data.
Eg: x=200;
We cant able to store varible like above. We have to mention data
type.
Int a; //declaration.
a=100; //assignment.
DataTypes:
1) Primitive datatypes - to store single data at a time.
a) Eg: int a=100; a=200;
b) byte,short,int,long ---- Number..
c) Fload,double ---decimal number
d) Char -single character ‘a’ (single quot)
e) Boolean - (True/False).
2) Non-Primitive datatype.
a) String,
b) ArryaList (int a[]=new int[100] we can store 100 variables,
c) HashMap,
d) HashSet etc…
While Loop:
package day5;
Dimentional array:
package day6;
Object Variable:
In object variable we can store any type of data like string, float,
double,boolean,char…
package day6;
package day6;
Print Even and Odd numbers arrays and count of that array
package day6;
package day6;