write a simple program inheritance?
Answers were Sorted based on User's Feedback
Answer / prashant khot
class A
{
}
class B extends A
{
public static void main(String args[])
{
B b = new B();
}
}
In the above example, B is the class extending the A class.
Means that B is inherited from A.
Is This Answer Correct ? | 26 Yes | 2 No |
Answer / dhawal
class A
{
int a=10;
}
class B extend A
{
public static void main(String[] a)
{
B objB;
objB=new A();
System.out.println("Value of a is"+objB.a);
}
}
Is This Answer Correct ? | 2 Yes | 13 No |
What are some characteristics of interference class?
What is role of void keyword in declaring functions?
How a class can implement an interface?
What is java reflection?
Why sleep()is in Thread and wait() in Object class? Why can't I have both in one class or vice versa?
What is finally and finalize in java?
Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me
Why do we create threads in java?
What is the difference between the final method and abstract method?
Explain about the performance aspects of core java?
I declared main() method as private. But it still running and displaying the output. Please Answer it . Code Snippet as Below: import java.io.*; class over { private static void main(String[] args) { int high = Integer.MAX_VALUE; int overflow = high + 1; int low = Integer.MIN_VALUE; int underflow = low - 1; System.out.println(high + "\n" +overflow +"\n"+ low +"\n"+underflow); //System.out.println(overflow); //System.out.println(low); //System.out.println(underflow); } }
explain different ways of using thread? : Java thread