Basics of Java
Description: The Java is programming language.The objective questions include program and other object oriented technology. | |
Number of Questions: 25 | |
Created by: | |
Tags: Applet Data Types Variables and Storage Classes Java/Oracle /C/C++ Strings and Character Arrays File Handling |
Which of the following is not an access specifier?
Which type of inheritance is not possible/allowed in Java using extends keyword?
________ modifier is often used in multithreaded programs.
Which of the following is/are difference(s) between class and interface? (a) Class can be instantiated, while interface cannot. (b) Class is a collection of data members and methods, while Interface consists of constants and method declarations. (c) Any class can extend another class using keyword extends, while interfaces are implemented using keyword implements.
Which of the following cannot generate an event?
Which of the following keywords is not present in Java?
Which of the following is/are not the method(s) in life cycle of an applet? (a) init (b) start (c) stop (d) destroy (e) paint
Which of the following features present in C/C++ is not supported by Java?
To which class does the method to UpperCase() belong?
What is the output of a Java compiler?
What will be the output of following code: class pattern { public static void main(String arts[]) String a = "WELCOME", b; for(i=0; i<=a.length(); i ++;) { b= a.substring(0,i); system.out.print(b); } } }
What is the use of Super keyword in Java?
Which of the following functions is performed by the program given below? class Demo { public static void main(String args[]) { int m, n=4325; int s=0; while(n!=0) { m=n%10; s=s+m; n=n/10; } System.out.println(“…………”+s); } }
What is the difference between == and equals()?
Which of the following accesses is/are provided by RandomAccessFile class?
class Demo {public static void main(String[] args) {StringBufferch=new StringBuffer(DAD); StringBufferst=new StringBuffer(ch);st=st.reverse(); String str=new String(st); String sta=new String(ch); if(str.equals(sta)) System.out.println(…….); else System.out.print(……..);}}
The above written program code
Which of the following is/are not the built in exception(s) in Java? (a) ArrayIndexOutOfBoundsException (b) NullPointerException (c) Arithmetic Exception (d) IOException
Which of the following is not a built in class in Java?
Which of the following is/are not the difference(s) between Abstract Class and Interfaces? (a) A class can implement several interfaces but may extend only one abstract class. (b) No constructors are provided by interfaces, while abstract class provides constructors. (c) Variables in interfaces must me public, static or final. There is no such restriction in abstract class.
Which of the following is/are the conditions for automatic type conversion? (a) The two types are compatible. (b) The destination type is lager than the source type. (c) The source type is lager than the destination type. When one type of data is assigned to another type of variable, an automatic type conversion takes place if some conditions are met.
What will be the output of following program code?
importjava.util.StringTokenizer;
publicclassTokendemo
{
publicstaticvoid main(String[] args)
{
StringTokenizerst=newStringTokenizer(Hi how are you?);
while(st.hasMoreTokens())
{
System.out.println(st.nextToken());
}
}
}
Which of the following specifies the creation of event handlers in certain situations?
Which exception is thrown when user provides divisor as zero, i.e. c=a/b, where b=0?
How the further can inheritance be stopped?
What will be the output of the following program code?
publicclassSuperdenmo
{
publicstaticvoid main(String[] args)
{
B b=new B();
b.add();
b.display();
}
}
class A
{
intx,y;
A()
{
x=10;
y=20;
}
}
class B extends A
{
intx,y,a,b;
B()
{
x=100;
y=200;
}
void add()
{
a=x+super.x;
b=y+super.y;
}
void display()
{
System.out.print(“value of a=”+a+nvalue of b=+b);
}
}