[Go to site: main page, start]

0% found this document useful (0 votes)
9 views2 pages

Java Objects and Classes Explained

The document contains Java class definitions and methods, including a MyClass with a constructor and display method, and a Student class with overloaded constructors. It also mentions the use of StringBuilder for string manipulation and garbage collection methods. Additionally, it references method overloading with two add methods for different data types.

Uploaded by

Afreed Shahid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Java Objects and Classes Explained

The document contains Java class definitions and methods, including a MyClass with a constructor and display method, and a Student class with overloaded constructors. It also mentions the use of StringBuilder for string manipulation and garbage collection methods. Additionally, it references method overloading with two add methods for different data types.

Uploaded by

Afreed Shahid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

public class MyClass { private int x;

String name; public MyClass(int x, String name){ this.x=x;


[Link]=name; } public void display(){ [Link](x + "
" + name); } }new

[Link](); [Link]();

class Student{ int id; String name; Student(){ id=0;


name="Unknown"; } Student(int i, String n){ id=i; name=n; } }
this(...)

finalize()

StringBuilder sb=new
StringBuilder("Hi"); [Link](" Java");

this
this.x = x;

[Link]()[Link]().gc()
int add(int a,int
b); double add(double a,double b);

You might also like