Logo

Java Questions Set 99:

Quiz Mode

 Identifiers can not start with?

1
2
3
4

Solution:

Which of these is used to allocate memory to array variable in java

1
2
3
4

Solution:

What is the output of the following Java program that uses a PriorityQueue?

1
2
3
4

Solution:

Arrange the operators according to their precedence

a> ++

b> *

c> ()

d> >>

1
2
3
4

Solution:

class jj

{

public static void main(String args[])

StringBuffer sb = new StringBuffer("Abekus");

sb.delete(1,2);

System.out.println(sb);

   }

}

1
2
3
4

Solution:

What is the output of the following Java code?

 

public class Abekus {

public static void main(String[] args) {

if (true)

break;

}

}

1
2
3

Solution:

 

public class example {
  int i[] = {0};
  public static void main(String args[]) {
     int i[] = {1};
     change_i(i);
     System.out.println(i[0]);
  }
  public static void change_i(int i[]) {
     int j[] = {2};
     i = j;
  }
}

1
2
3
4

Solution:

What will be the output of the following Java program?


  1. import java.net.*;
  2. class Networking
  3. {
  4. public static void main(String[] args) throws MalformedURLException
  5. {
  6. URL obj = new URL("https://www.abekus.com/javamcq");
  7. System.out.print(obj.getHost());
  8. }
  9. }

1
2
3
4

Solution:

What will be the output of the following Java code?


class NewThread extends Thread

{

Thread t;

NewThread()

{

t = new Thread(this, "New Thread");

t.start();

}

public void run()

{

System.out.println(t.isAlive());

}

}

class MultithreadedProgramming

{

public static void main(String[] args)

{

new NewThread();

}

}

1
2
3
4

Solution:

    import java.util.*;

    class output 

    {

        public static void main(String args[]) 

        {

            LinkedList obj = new LinkedList();

            obj.add("A");

            obj.add("B");

            obj.add("C");

obj.addLast(new Integer(25));

            obj.removeFirst();

            obj.removeLast();

obj.pollFirst();

            System.out.println(obj);

        }

    }

1
2
3
4
5

Solution: