aspose file tools*
The moose likes Beginning Java and the fly likes Abstraction Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstraction Example" Watch "Abstraction Example" New topic
Author

Abstraction Example

Jdinesh Tiwari
Ranch Hand

Joined: Jan 13, 2013
Posts: 35
Hi, and thanks in advance to all I tried to implement this example to learn scenario of abstraction practically ? But I am facing 9 nos. of compile time error ? Whats the problem with this code

abstract ClassA{
int x,y;
void method(int x, int y)
{}
abstract void method2();
abstract void method3();
}
ClassB extends ClassA{
void method2()
{
System.out.println("this is Method 2 of class B");
}
void method3()
{
System.out.println("this is Method 3 of class B");
}
}
ClassC extends ClassA{
void method2()
{
System.out.println("this is Method 2 of class C");
}
void method3()
{
System.out.println("this is method 3 of class C");
}
}

public class MainClass {
public static void main(String[]args){

ClassA obj1 = new ClassB();
obj1.method2();
obj1.method3();

ClassA obj2 = new ClassC();
obj2.method2();
obj2.method3();
}
}
M Mohile
Greenhorn

Joined: Sep 22, 2012
Posts: 17
It should be abstract class ClassA and not abstract ClassA. Similarly, follow the same for ClassB and ClassC..Hope this helps..
shakil ahamad
Greenhorn

Joined: Mar 02, 2013
Posts: 1
We better have a good quality performance testing.website performance test
Jdinesh Tiwari
Ranch Hand

Joined: Jan 13, 2013
Posts: 35
Dear Mohile, Thank you
M Mohile
Greenhorn

Joined: Sep 22, 2012
Posts: 17
My pleasure.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Abstraction Example