4 October 2013

JAVA Practical File (Btech)

AIM:- Write a program in JAVA which is initialized through object and current object.

Program:-


  class Test
{
int x,y;
}

class Test1
{
public static void main (String args[])
{
Test t = new Test();
t.x= 10;
t.y= 20;
int c= t.x + t.y;
System.out.println("Sum of two numbers is"+ " " +c);
}
}

Output:- The sum of two numbers is 30


0 comments:

Post a Comment