Professional Documents
Culture Documents
BASIC JAVA
• public class Test {
• int a=5;
• boolean b=true;
• char c='A';
• double d=34.25;
• System.out.println(a);
• System.out.println(b);
• System.out.println(c);
• System.out.println(d);
• }
• }
• public class test1 {
• float a=(float)12.34;
• System.out.println(a);
• }
• }
• class Rectangle1
• {
• int l,b;
public class RectangleTest {
• public void display()
• {
• System.out.println("length="+l);
public static void main(String[]
• System.out.println("breadth="+b);
• }
args) {
• } Rectangle r=new Rectangle();
• public class Rectangle extends Rectangle1 {
r.setDimension(10, 30);
r.display();
• public int area()
• {
• return l*b;
• }
System.out.println("Area="+r.ar
• public void setDimension(int x,int y) ea());
• {
•
•
l=x;
b=y;
}
• }
}
• }
• public class test3 {
• int a,b;
• {
• this.a=a;
• this.b=b;
• System.out.println(" in two argument constructor");
• }
• public test3(int a)
• {
• this(a,10);
• public test3()
• {
• this(2,3);
• x.display();
• }
• }