Saturday, 7 July 2018

Java Program for Classes and Objects

class object_new
{
int id;
String name;

public void method1(int d,String n)
{
id = d;
name = n;
}
public void display()
{
System.out.println("My id is :"+ id);
System.out.println("My name is :"+ name);
}
}
class object1
{
public static void main(String args[])
{
object_new obj=new object_new();
object_new obj1=new object_new();
obj.method1(99,"Balwant Singh");
obj1.method1(101,"BSB");
obj.display();
obj1.display();
}
}

No comments:

Post a Comment

Oracle / PLSQL: FOR LOOP

set serveroutput on; declare a1 varchar2(100); begin select count(*) into a1 from employees; for i in 1..a1 loop dbms_output.put_line...