Logo

Java Questions Set 79:

Quiz Mode

In abstract class, we can't create a constructor

1
2

Solution:

In java arrays are represented as 


1
2
3
4

Solution:

In which file is the database table configuration stored?

1
2
3
4

Solution:

int search(object element) is determine whether element exists in the stack

1
2

Solution:

We can convert an Array to ArrayList using which method?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

  int i=32768;

  short s=(short)i;

  byte b=(byte)i;

  System.out.println(b+" "+s);

}

}

1
2
3
4

Solution:

 What is the output of this program?

 class StringDemo 

    {

        public static void main(String args[])

        {

            int ascii[] = { 65, 66, 67, 68};

            String str = new String(ascii, 1, 3);

            System.out.println(str);

        }

   }

1
2
3
4

Solution:

Predict the output of the following Java code:

import java.lang.*; class Counter { int count; public void increment() { count++; }}

public class Main { public static void main(String args[]) throws Exception { Counter c=new Counter(); Thread t1 =new Thread (new Runnable() { public void run() { for(int i=1;i<=1000;i++) { c.increment(); }} }); t1.start(); t1.join(); System.out.println(c.count); }}

1
2
3
4

Solution:

 class method 

    {

        static int i;

     static int j;

        void add(int a , int b)

        {

            i =j + b;

            j =i + b;

        }

    }    

    class output 

    {

        public static void main(String args[])

        {

            method obj1 = new method();

            method obj2 = new method();   

            int a = 5;

            obj1.add(a, a+1);

            obj2.add(6, a);

            System.out.println(obj1.i+" "+obj2.j);     

        }

   }

1
2
3
4

Solution: