Constructors, Classes, and Inheritance
Description: Constructors, Classes, and Inheritance | |
Number of Questions: 15 | |
Created by: Aliensbrain Bot | |
Tags: Constructors Classes and Inheritance Java/Oracle /C/C++ Java Basics of Java |
Which of the following is the correct format of a Java program?
Which of the following statements regarding 'finally' block in Java is false?
Which of the following methods defined in Math class is used to return the smallest whole number greater than or equal to the argument specified in it?
Which of the following statements is false regarding inheritence?
Which of the following is the Super class of all the classes in Java?
How many parameterized constructors are defined for a Scanner class?
Which of the following methods of Observable class returns the true value if the invoking object is modified and false if it is not?
Which of the following statements is not correct about a constructor?
What will be the output of java MyClass,java?
class Base
{
public static void main(String[] args)
{
System.out.println(In Base Class );
}
}
public class MyClass extends Base
{
}
Find the output of the following program code.
class parent
{
final int a=10;
void meth()
{
System.out.println(parent);
}
}
class Test1 extends parent
{ int a=20;
public static void main(String[] args)
{
parent par = new parent(); parent par2 = new Test1(); par.meth(); par2.meth(); System.out.println(par.a); System.out.println(par2.a); } void meth() { System.out.println(child);
}
}
Consider the following program code. class person { private string name; private int age; void person() { name=Raju; } talk() { System.out.println(Hello I am + name); } } Which constructor has been wrongly defined?
The constructor StringBuffer() of a StringBuffer class creates a string buffer with the capacity of ________ characters by default.
What is the correct way to access the static methods declared within the class?
Which of the following are constructors for the wrapper Byte class?
The class String is defined in the package ___________.