java material
java material
The sandbox is a set of rules that apply to all Java code running in
the JVM.
Object oriented languages follow bottom to top approach
In Java, every application begins with a class name, and that class must
match the filename.
To run java code >javac “filename.java”
To compile the code >java “filename”
Every line of code that runs in java must be inside a class.a class should
always start with a capital letter
every program must contain the main() method
each code statement must end with a semicolon ( ;).
Print methods:
Char
Short
Int
Long
Float
double
2.non primitive data type - defined by the programmer
Example: classes objects strings arrays interfaces etc
Type casting in java :
1 widening casting : when passing a smaller size type to a larger size type. Converting a small data
type to large datatype . it is done automatically by language
Example : assaigning an integer value to double value then the integer value is converted into
double value
Int num=9;
Double d= num;
2. Narrowing casting : bigger data type to smaller data type it should be done manually
operators in java:
arthematic operators
logical operators : “&&”-logical and , “||”-logical or ,” ! ” – Logical not
STRINGS IN JAVA :