-
}
}
public class test1 extends test
{
public void say()
{
super.hello();
hello();
}
public void main(String arg[])
{
test1 t = new test1();
t.say();
}
}
In the above code what will be difference of super.hello(); and hello();. What is use of super instead of calling directly method name.
">Public class test{ public void hello() { System.out.println("Helllo"); }}public class test1 extends test{ public void say(){ super.hello(); hello();}public void main(String arg[]){ test1 t = new test1(); t.say();}}In the above code what will be difference of super.hello(); and hello();. What is use of super instead of calling directly method name.
-
-
-
-
-
Run Time Exceptions
What do exception mean in java ? what type of run time exceptions?
-
Nested and Inner Classes
What is the need of nested and inner classes in Java? Explain where they are useful?
-
Which of the following options can be inserted at the commented line to compile the given code:
cpublic class Class1 {
Class1(String s){ }
Class1() { }
}
class Class2 extends Class1{
Class2(){ }
Class2(String s) {super(s);}
void m1() {
// insert code here
}
}
a) Class1 c1 = new Class1("HCL"){ }
b) Class1 c1 = new Class2(){ };
c) Class2 c3 = new Class1(String s){};
d) Class1 c1 = new Class1(100){ }; -
Print Only Numbers From Java Strings
I have a question in Java-string,
String s="adf5hgjyu1frdsff6vgyu7bnjh9asd3"; like
How to print only numbers in that string -
Can a lock be acquired on a class
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object..
-
What modifiers may be used with an inner class that is a member of an outer class
A (non-local) inner class may be declared as public, protected, private, static, final, orabstract.
-
Is a class a subclass of itself
A class is a subclass of itself.
-
-
-
What is the unit for 1000 in the below statement?ob.sleep(1000)
A) Int millisecondsB) Double millisecondsC) long millisecondsD) Float milliseconds
-
-
Which of the following are true about the Error and Exception classes?
A) Both classes extend Throwable.B) The Error class is final and the Exception class is not.C) The Exception class is final and the Error is not.D) Both classes implement Throwable.
-
The term _____________ refers to a class's direct ancestor or to any of its ascendant classes.
Skill/Topic: InheritanceA) Sub ClassB) Super ClassC) Class hierarchy
-
Java I/O is based on the concept of _________
Skill/Topic: AWT & AppletsA) ClassesB) StreamsC) BuffersD) Threads
-
The concept of polymorphism is often expressed by the phrase
Skill/Topic: AWT & AppletsA) One interface, multiple methodsB) Multiple interface, one MethodC) Multiple interface, Multiple methodD) One interface, One method
Java Interview Questions
Ans