public class MainMethod
{
public static int main(String[] args)
{
return 1;
}
}
public class MainMethod
{
public static int main(String[] args)
{
return 1;
}
}
Can we call sub class constructor from super class constructor?
Can we call sub class constructor from super class constructor?
IIB stands for :___________
IIB stands for :___________
What is the output for following code
final class Complex {
private double re, im;
public Complex(double re, double im) {
this.re = re;
this.im = im;
}
Complex(Complex c) {
System.out.println("Copy constructor called");
re = c.re;
im = c.im;
}
public String toString() {
return "(" + re + " + " + im + "i)";
}
}
class Main {
public static void main(String[] args) {
Complex c1 = new Complex(10, 15);
Complex c2 = new Complex(c1);
Complex c3 = c1;
System.out.println(c2); }
}
What is the output for following code
final class Complex {
private double re, im;
public Complex(double re, double im) {
this.re = re;
this.im = im;
}
Complex(Complex c) {
System.out.println("Copy constructor called");
re = c.re;
im = c.im;
}
public String toString() {
return "(" + re + " + " + im + "i)";
}
}
class Main {
public static void main(String[] args) {
Complex c1 = new Complex(10, 15);
Complex c2 = new Complex(c1);
Complex c3 = c1;
System.out.println(c2); }
}
Which of these methods of Object class can clone an object?
Which of these methods of Object class can clone an object?
What is the output for following code
public static void main(String args[]) {
int num1,num2,num3;
num1 = 100;
num2 = ++num1;
num3 = num2++ + ++num1;
System.out.println("num1 = " + num1);
System.out.println("num2 = " + num2);
System.out.println("num3 = " + num3);
}
What is the output for following code
public static void main(String args[]) {
int num1,num2,num3;
num1 = 100;
num2 = ++num1;
num3 = num2++ + ++num1;
System.out.println("num1 = " + num1);
System.out.println("num2 = " + num2);
System.out.println("num3 = " + num3);
}
What is the output for following code
public static void main(String[] args)
{
A a = new B();
B b = new B();
System.out.println(a.c + " " + a.getValue() +
" " + b.getValue() + " " + b.getSuperValue());
}
}
class A
{
protected char c = 'A';
char getValue()
{
return c;
}
}
class B extends A
{
protected char c = 'B';
char getSuperValue()
{
return super.c;
}
What is the output for following code
public static void main(String[] args)
{
A a = new B();
B b = new B();
System.out.println(a.c + " " + a.getValue() +
" " + b.getValue() + " " + b.getSuperValue());
}
}
class A
{
protected char c = 'A';
char getValue()
{
return c;
}
}
class B extends A
{
protected char c = 'B';
char getSuperValue()
{
return super.c;
}
What is the output for following code
private int data = 5;
public int getData()
{
return this.data;
}
public int getData(int value)
{
return (data+1);
}
public int getData(int... value)
{
return (data+2);
}
public static void main(String[] args)
{
Test temp = new Test();
System.out.println(temp.getData(9, 11, 14));
}
What is the output for following code
private int data = 5;
public int getData()
{
return this.data;
}
public int getData(int value)
{
return (data+1);
}
public int getData(int... value)
{
return (data+2);
}
public static void main(String[] args)
{
Test temp = new Test();
System.out.println(temp.getData(9, 11, 14));
}
Which one of these lists contains only Java programming language keywords?
Which one of these lists contains only Java programming language keywords?
-
-
-
-
-
What is the output for following code
public static void main(String []args){
for(int i=0;i<10;i++)
{
if( i == 5)
continue;
System.out.println(i);
}
}
What is the output for following code
public static void main(String []args){
for(int i=0;i<10;i++)
{
if( i == 5)
continue;
System.out.println(i);
}
}
What is the output for following code
class Alpha
{
public String type = "a ";
public Alpha() { System.out.print("alpha "); }
}
public class Beta extends Alpha
{
public Beta() { System.out.print("beta "); }
void go()
{
type = "b ";
System.out.print(this.type + super.type);
}
public static void main(String[] args)
{
new Beta().go();
}
}
What is the output for following code
class Alpha
{
public String type = "a ";
public Alpha() { System.out.print("alpha "); }
}
public class Beta extends Alpha
{
public Beta() { System.out.print("beta "); }
void go()
{
type = "b ";
System.out.print(this.type + super.type);
}
public static void main(String[] args)
{
new Beta().go();
}
}
Which of the following converts human readable file into platform independent code file in java?
Which of the following converts human readable file into platform independent code file in java?
Java allow, Same program to be executed on multiple Operating System?
Java allow, Same program to be executed on multiple Operating System?
What is the output for following code
public static void main(String []args){
System.out.println("Hello World");
for(;true;) //Line 1
System.out.println("hello"); //Line 2
System.out.println("Bye"); //Line 3
}
What is the output for following code
public static void main(String []args){
System.out.println("Hello World");
for(;true;) //Line 1
System.out.println("hello"); //Line 2
System.out.println("Bye"); //Line 3
}
Java does not support ___________
Java does not support ___________
When Overloading does not occur?
When Overloading does not occur?
What is the return type of a method that does not returns any value
What is the return type of a method that does not returns any value
What is the numerical range of a char?
What is the numerical range of a char?
Platform independent code file created Source file is understandable by ____________
Platform independent code file created Source file is understandable by ____________
Java Object oriented programming is/are
Java Object oriented programming is/are
Which of these statement is incorrect?
Which of these statement is incorrect?
What is the output for following code
public static void main(String []args){
switch(2)
{
case 1:System.out.println("Hi");
break;
case 1+1:System.out.println("Hello");
break;
default: System.out.println("Bye");
break;
}
}
What is the output for following code
public static void main(String []args){
switch(2)
{
case 1:System.out.println("Hi");
break;
case 1+1:System.out.println("Hello");
break;
default: System.out.println("Bye");
break;
}
}
what is the output for following code
class T {
int t = 20;
T() {
t = 40;
}
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
what is the output for following code
class T {
int t = 20;
T() {
t = 40;
}
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
What is the output for following code
public class Calculator
{
int num = 100;
public void calc(int num) { this.num = num * 10; }
public void printNum() { System.out.println(num); }
public static void main(String[] args)
{
Calculator obj = new Calculator();
obj.calc(2);
obj.printNum();
}
}
What is the output for following code
public class Calculator
{
int num = 100;
public void calc(int num) { this.num = num * 10; }
public void printNum() { System.out.println(num); }
public static void main(String[] args)
{
Calculator obj = new Calculator();
obj.calc(2);
obj.printNum();
}
}
What is the out put for following code
public static void main(String []args){
int i=-23;
if(i)
System.out.println("Hi");
else
System.out.println("Hello" );
What is the out put for following code
public static void main(String []args){
int i=-23;
if(i)
System.out.println("Hi");
else
System.out.println("Hello" );
What is the output for following code
public class StaticVariableExample
{
static int a =10,b=10;
public static void main (String args[]){
StaticVariableExample s1 = new StaticVariableExample ();
System.out.println ("s1.a value:"+s1.a);
s1.b=20; //Line 1
System.out.println ("s1.a value:"+s1.b);
}
}
What is the output for following code
public class StaticVariableExample
{
static int a =10,b=10;
public static void main (String args[]){
StaticVariableExample s1 = new StaticVariableExample ();
System.out.println ("s1.a value:"+s1.a);
s1.b=20; //Line 1
System.out.println ("s1.a value:"+s1.b);
}
}
What is the output for following code
public static void main(String []args){
System.out.println("Hello World");
for(int i=5;i>=0;i--){
for(int j=0;j<=i;j++)
System.out.print("*");
System.out.println();
}
}
What is the output for following code
public static void main(String []args){
System.out.println("Hello World");
for(int i=5;i>=0;i--){
for(int j=0;j<=i;j++)
System.out.print("*");
System.out.println();
}
}
Which is a valid keyword in java?
Which is a valid keyword in java?
What is the output of the following code
int a=10,b;
b=a++ + ++a + a++ + ++a;
System.out.println(“a is :”+ a +” -- b is:”+b);
What is the output of the following code
int a=10,b;
b=a++ + ++a + a++ + ++a;
System.out.println(“a is :”+ a +” -- b is:”+b);
What is the output for following code
public class Fibonacci {
public static void main(String[] args) {
int lo = 1;
int hi = 1;
System.out.println(lo);
while (hi < 50) {
System.out.print(“ -“ +hi);
hi = lo + hi;
lo = hi - lo;
}
}
}
.
What is the output for following code
public class Fibonacci {
public static void main(String[] args) {
int lo = 1;
int hi = 1;
System.out.println(lo);
while (hi < 50) {
System.out.print(“ -“ +hi);
hi = lo + hi;
lo = hi - lo;
}
}
}
.
JVM is a _______________.
JVM is a _______________.
What is the output for following code
public class Main
{
public static void gfg(String s)
{
Ssytem.out.println("String");
}
public static void gfg(Object o)
{
Sysatem.out.println("Object");
}
public static void main(String args[]){
gfg(2.5);
}
}
What is the output for following code
public class Main
{
public static void gfg(String s)
{
Ssytem.out.println("String");
}
public static void gfg(Object o)
{
Sysatem.out.println("Object");
}
public static void main(String args[]){
gfg(2.5);
}
}
Java static block is the group of statements that gets executed when the class is not loaded into memory by Java Class Loader .
Java static block is the group of statements that gets executed when the class is not loaded into memory by Java Class Loader .
Loose coupling in java programs can be done by
Loose coupling in java programs can be done by
Which of these keywords cannot used for a class which has been declared final?
Which of these keywords cannot used for a class which has been declared final?
What is the output for following code
class Test1 {
int x = 10;
public static void main(String[] args)
{
System.out.println(x);
}
static
{
System.out.print(x + " ");
}
}
What is the output for following code
class Test1 {
int x = 10;
public static void main(String[] args)
{
System.out.println(x);
}
static
{
System.out.print(x + " ");
}
}
What is the output for following code
Class ConsMain{
private int x=10;
private ConsMain(){
x = 5;
}
public static void main(String[] args){
ConsMain obj = new ConsMain();
System.out.println("Value of x = " + obj.x);
}
}
What is the output for following code
Class ConsMain{
private int x=10;
private ConsMain(){
x = 5;
}
public static void main(String[] args){
ConsMain obj = new ConsMain();
System.out.println("Value of x = " + obj.x);
}
}
What is the output for following code
public class Test
{
static int x = 2;
Test(int i) { x = i; }
public static void main(String[] args) {
Test t = new Test(5);
System.out.println("x = " + t.x);
}
}
What is the output for following code
public class Test
{
static int x = 2;
Test(int i) { x = i; }
public static void main(String[] args) {
Test t = new Test(5);
System.out.println("x = " + t.x);
}
}
What is the output for following code
public static void main(String []args){
switch('a'){
case 1:System.out.println("Hi");
break;
case 97:System.out.println("Hello");
break;
case 'a':System.out.println("Bye");
break;
default : break;
}
}
What is the output for following code
public static void main(String []args){
switch('a'){
case 1:System.out.println("Hi");
break;
case 97:System.out.println("Hello");
break;
case 'a':System.out.println("Bye");
break;
default : break;
}
}
Can a static block exist without a main() method ?
Can a static block exist without a main() method ?