day-12: A Comprehensive Guide to Java Objects, Data Types, and Variable Initialization
Class: Blue Print - Company - Noun Object: Physical entity - Employee - instance Method: Task - Verb To create Object: -> Class_name object_name = new Class_name -> States and Behaviors Example for Mobile: States: Touch display, GPU, RAM Behavior: Calling, Recording... Primitive Datatypes(variables)in Java: number: byte, short, int, long, double string: char, boolean String Non-Primitive Datatypes: String Variable Declaration and Initialization: Declaration: int tamil, int english, int maths Initialization: tamil = 88, english = 73, maths, science Assignment Operator: -> Assigning Right side value to left side variable. Example Programme: public class Theatre { // variable declaration is a one of the parts for object int ticket_fare; //int float show_time; //float String movie_name; //String boolean on_screen; //boolean // variable Initialization is a one of the parts for object boolean parking_charge = false; public static void main(String[] args) { // Object creation Theatre screen1 = new Theatre(); Theatre screen2 = new Theatre(); Theatre screen3 = new Theatre(); screen1.movie_name = "Leo"; screen2.movie_name = "Vidaamuyarchi"; screen3.movie_name = "VDS Part 2"; screen1.show_time = 11.30f; screen2.show_time = 11.00f; screen3.show_time = 11.20f; System.out.println(screen1.movie_name); } } *Output: * Leo Here: Theatre is a class Objects: Theatre screen1 = new Threatre(); Method: public static void main(String[] args) Interview Questions: 1). How many Primitive Datatypes in Java? What are they? Total 8, they are - byte, char, short, int, float, double, long, boolean 2). How do you create Object in Java? Class_name object_name = new Class_name(); 3). How do you assign values to variables in Java? data_type variable_name = value; -------------------------- End of the Blog ----------------------

Class: Blue Print - Company - Noun
Object: Physical entity - Employee - instance
Method: Task - Verb
To create Object:
-> Class_name object_name = new Class_name
-> States and Behaviors
Example for Mobile:
States: Touch display, GPU, RAM
Behavior: Calling, Recording...
Primitive Datatypes(variables)in Java:
number: byte, short, int, long, double
string: char, boolean String
Non-Primitive Datatypes:
String
Variable Declaration and Initialization:
Declaration:
int tamil, int english, int maths
Initialization:
tamil = 88, english = 73, maths, science
Assignment Operator:
-> Assigning Right side value to left side variable.
Example Programme:
public class Theatre {
// variable declaration is a one of the parts for object
int ticket_fare; //int
float show_time; //float
String movie_name; //String
boolean on_screen; //boolean
// variable Initialization is a one of the parts for object
boolean parking_charge = false;
public static void main(String[] args)
{ // Object creation
Theatre screen1 = new Theatre();
Theatre screen2 = new Theatre();
Theatre screen3 = new Theatre();
screen1.movie_name = "Leo";
screen2.movie_name = "Vidaamuyarchi";
screen3.movie_name = "VDS Part 2";
screen1.show_time = 11.30f;
screen2.show_time = 11.00f;
screen3.show_time = 11.20f;
System.out.println(screen1.movie_name);
}
}
*Output: *
Leo
Here:
Theatre is a class
Objects:
Theatre screen1 = new Threatre();
Method:
public static void main(String[] args)
Interview Questions:
1). How many Primitive Datatypes in Java? What are they?
Total 8, they are - byte, char, short, int, float, double, long, boolean
2). How do you create Object in Java? Class_name object_name = new Class_name();
3). How do you assign values to variables in Java?
data_type variable_name = value;
-------------------------- End of the Blog ----------------------