example on interface concept of java on multiple inhertence
or any tuitorial
This post has been edited by prajayshetty: 18 June 2008 - 12:01 PM




Posted 18 June 2008 - 11:51 AM
This post has been edited by prajayshetty: 18 June 2008 - 12:01 PM
Posted 19 June 2008 - 10:06 AM
jjsaw5, on 18 Jun, 2008 - 12:45 PM, said:
This post has been edited by prajayshetty: 19 June 2008 - 11:13 AM
Posted 19 June 2008 - 11:45 AM
import java.util.*;
import java.lang.*;
interface hello
{
void getdata();
}
class c implements hello
{
int c;
public void getdata()
{
Scanner in = new Scanner(System.in);
System.out.println("enter a");
c=Integer.valueOf(in.nextLine());
}
public static void main(String args[])
{
prajay p;
c ca =null;
d da =null;
p=da;
p.getdata();
}
}
class d implements hello
{
int b;
public void getdata()
{
Scanner in = new Scanner(System.in);
System.out.println("enter b");
c ca =null;
prajay p;
p=ca;
p.getdata();
b=Integer.valueOf(in.nextLine());
d da = null;
p=da;
p.getdata();
p=ca;
}
}
This post has been edited by prajayshetty: 19 June 2008 - 11:48 AM
Posted 19 June 2008 - 11:52 AM
This post has been edited by prajayshetty: 19 June 2008 - 11:53 AM
Posted 19 June 2008 - 11:56 AM
prajay p; p=ca;
B b = new B();
int c = b.b;
Posted 19 June 2008 - 12:01 PM
Posted 19 June 2008 - 12:11 PM
import java.util.*;
import java.lang.*;
interface hello
{
void getdata();
}
class first implements hello
{
int c;
public void getdata()
{
Scanner in = new Scanner(System.in);
System.out.println("enter a");
c=Integer.valueOf(in.nextLine());
}
public static void main(String args[])
{
hello p;
first ca =null;
second da =null;
p=da;
p.getdata();
}
}
class second implements hello
{
int b;
public void getdata()
{
Scanner in = new Scanner(System.in);
System.out.println("enter b");
first ca =null;
hello p;
p=ca;
p.getdata();
b=Integer.valueOf(in.nextLine());
second da = null;
p=da;
p.getdata();
p=ca;
}
}
first c;
int d=0;
d=c.d;
System.out.println("d of class first =",+d);
This post has been edited by prajayshetty: 19 June 2008 - 12:25 PM
Posted 19 June 2008 - 12:33 PM
class second implements hello
{
int b;
public void getdata()
{
Scanner in = new Scanner(System.in);
System.out.println("enter b");
first ca = new first();
hello p;
p=ca;
p.getdata();
b=Integer.valueOf(in.nextLine());
second da = null;// this line isnt needed. Why create a new instance of the class your working in?
int variablefromclassfirst = ca.c;
p=da;
p.getdata();
p=ca;
}
}
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
