Name: Hemasri J Reg No: 2413711058011 Java Record Ex.no:0 1 PROGRAM FOR CLASS AND OBJECTS Aim: To Write a Program to implement Classes an Objects using Java PROCEDURE: 1. Create a class with data members and a display method. 2. Create an object of the class. 3. Assign values to the object variables. 4. Call the display method using the object. 5. Display the object details. Code: Name: Hemasri J Reg No: 2413711058011 OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:0 2 PROGRAM FOR CONSTRUCTORS Aim: To Write a Program to implement Constructors using Java PROCEDURE: 1. Create a class with different types of constructors. 2. Define default, parameterized and copy constructors. 3. Create objects using each constructor. 4. Display the initialized values. 5. Observe constructor execution. Code: Name: Hemasri J Reg No: 2413711058011 OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no: 03 PROGRAM FOR ACCESS MODIFIERS USING SAME PACKAGES Aim: To Write a Program to implement accessing the modifiers in one package using Java PROCEDURE: 1. Create a class with different access modifiers. 2. Create another class in the same package. 3. Create an object of the first class. 4. Access the permitted members. 5. Display the accessible members. Code: 1.AccessDemo Name: Hemasri J Reg No: 2413711058011 2.TestDemo OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:0 4 PROGRAM FOR ACCESS MODIFIERS USING DIFFERENT PACKAGES Aim: To Write a Program to implement accessing the modifiers in different package using Java PROCEDURE: 1. Create a class with different access modifiers. 2. Create another class in a different package. 3. Extend the parent class if required. 4. Access the allowed members. 5. Display the accessible members. Code: Name: Hemasri J Reg No: 2413711058011 OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:0 5 PROGRAM FOR SCANNER CLASS Aim: To Write a Program to implement Scanner package using Java PROCEDURE: 1. Import the Scanner package. 2. Create a Scanner object. 3. Read user input. 4. Store the entered value. 5. Display the input. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:0 6 PROGRAM FOR BUFFER CLASS Aim: To Write a Program to implement Buffer Input using Java PROCEDURE: 1. Import the required I/O package. 2. Create a BufferedReader object. 3. Read input from the user. 4. Store the input in a variable. 5. Display the entered value. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:0 7 PROGRAM FOR THROW AND THROWS Aim: To Write a Program to implement throw throws using Java PROCEDURE: 1. Create a method that checks a condition. 2. Use throw to generate an exception. 3. Declare the exception using throws. 4. Handle the exception using try - catch. 5. Display the result. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no: 08 PROGRAM FOR TRY AND CATCH Aim: To Write a Program to implement Try and Catch using Java PROCEDURE: 1. Create a program that may generate an exception. 2. Place the risky code inside the try block. 3. Handle the exception using the catch block. 4. Display an appropriate message. 5. Terminate the program normally. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no: 09 INTERFACES Aim: To write a program to implement on interface using java PROCEDURE: 1. Create an interface with abstract methods. 2. Create a class that implements the interface. 3. Define all interface methods. 4. Create an object of the implementing class. 5. Invoke the methods and display the output. Code: Name: Hemasri J Reg No: 2413711058011 OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:1 0 PROGRAM FOR CREATING MAIN THREAD AND CHILD THREAD Aim: To write a program to implement on Thread using java PROCEDURE: 1. Create a class by extending the Thread class. 2. Override the run() method. 3. Create a thread object. 4. Start the child thread using start(). 5. Execute both main and child threads simultaneously. Code: Name: Hemasri J Reg No: 2413711058011 OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:1 1 PROGRAM FOR OBJECTS AS PARAMETERS Aim: To write a program to implement object as parameter using java PROCEDURE: 1. Create a class with data members. 2. Define a method that accepts an object as a parameter. 3. Create two objects of the class. 4. Pass one object to the method. 5. Display the comparison result. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:1 2 PROGRAM FOR MEMBER ACCESS AND INHERITANCE Aim: To write a program to implement member access and inheritance using java PROCEDURE: 1. Create a parent class with data members. 2. Create a child class using inheritance. 3. Access the parent class member in the child class. 4. Create an object of the child class. 5. Display the inherited member. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:1 3 PROGRAM FOR METHOD OVERRRIDING Aim: To write a program to implement for method overriding using java PROCEDURE: 1. Create a parent class with a method. 2. Create a child class that overrides the method. 3. Create an object of the child class. 4. Invoke the overridden method. 5. Display the output. Code: OUTPUT: Name: Hemasri J Reg No: 2413711058011 Ex.no:1 4 PROGRAM FOR STATIC VARIABLES, METHODS Aim: To write a program to implement for Static method and variable using jav a. PROCEDURE: 1. Create a class with a static variable. 2. Define a static method. 3. Create multiple objects. 4. Update the static variable. 5. Display the common value using the static method. Code: OUTPUT: