Merged Java Final!!!
Merged Java Final!!!
OUTPUT:
Error: Division by zero is not allowed.
Execution completed.
public class GarbageCollectionDemo {
public static void main(String[] args) {
// Creating objects
for (int i = 0; i < 1000; i++) {
String temp = new String("Object " + i);
}
// Objects created inside the loop become eligible for garbage collection
// once they go out of scope (end of loop iteration).
OUTPUT:
Garbage Collection may happen after objects go out of scope!
x.age = 19;
program
import java util Scanner; x phnno = 123456;
class Employee x.address= Asha bhavanam";
{
String name; x salary=50000;
int age;
int phnno; x. specialization="Data analysis and Exploration";
String address;
double salary; System.out.println("DETAILS OF OFFICER");
void printDetails() (
x printDetails();
System.out.println("NAME:"+name);
System out.println("AGE"+age); x.printSalary();
System.out.println("PHONE NO:"+phnno);
System.out.println("ADDRESS."+address);
x printSpecialization();
}
void printSalary()
Manager y= new Manager();
{
System.out.println("SALARY:"+salary);
y name="Nirmal",
}
}
y.age = 26 ,
class Officer extends Employee
{
y.phnno=789012
String specialization;
void printSpecialization()
y.address="Nirmalayam";
{
System.out.println("SPECIALIZATION:"+specialization);
y.salary = 100000 ,
}
}
y.department = HR ;
class Manager extends Employee
Integer: 10
Double: 3.14
Integer 1: 1, Integer 2: 2
OUTPUT:
Drawing a Circle
Drawing a Rectangle