Classes and Objects in Java Example Programs

Classes and Objects in Java Example Programs

Classes and Objects in Java Example Programs


classes and objects in java example programs,difference between class and object in java,what is object class and method in java,addition program in java using classes and objects,methods classes and objects in java


Class and Object

import java.io.*;
class ajith
{
public string name;
public int age;
void getdata() throws IOException
{
DataInputStream in=new DataInputStream(System.in);
{
System.out.println("Enter the name and age is:");
name=in.readLine();
age=Integer.parseInt(in.readLine());
}
}
void putdata()
{
System.out.println("The given name is:"name);
System.out.println("The given age is:"+age);
}
}
class selva
{
public Static void main(String args[]) throws IOException
{
ajith a=new ajith();
a.getdata();
a.putdata();
}
}


Post a Comment

0 Comments