Signup as a Tutor

As a tutor you can connect with more than a million students and grow your network.

Free IT Courses Java Worksheets

Download free printable Java Worksheets to practice. With thousands of questions available, you can generate as many Java Worksheets as you want.

Download Worksheet

Sample IT Courses Java Worksheet Questions

1.
What is the output?
 public class Test {
    public static String out ="";
    public static void chk(int i) {
 	try {
	   if(i==1) {
	      throw new Exception();
	   }
	   out += "A";
	 }
	 catch(Exception e) {
	    out += "D";
	    return;
	 }
	 finally {
	    out += "B";
	 }
	 out += "C";
     }       
     public static void main (String [] args) {
       chk(0);
       chk(1);
       System.out.println(out);
     }
 }

 

1.

DBCAB

2.

ADBCDB

3.

ABCD

4.

ABCDB

2.

when constructor will be called 

1.

By calling method

2.

by creating object of that class

3.

Iterator cursor is having both directional movements?

1. True 2. False
4.

Is Vector thread safe ?

1. True 2. False
5.

in which collection in java insertion order preserved ?

1.

Arraylist

2.

Linkedlist

3.

Vector

4.

Stack

6.

ArrayList  implements Random Access interface.

1. True 2. False
7.

public class Exercise {

    public static void main(String[] args) {
        
        double x = 4.0 - 3.10;
        
        //System.out.println(x);
        
        System.out.println(x == 0.90);
    }
}

1. True 2. False
8.
class demo

{

    int a, b;

     

    demo()

    {

        a = 10;

        b = 20;

    }

     

    public void print()

    {

        System.out.println ("a = " + a + " b = " + b + "\n");

    }

}

 

class Test

{

 

    public static void main(String[] args)

    {

        demo obj1 = new demo();

        demo obj2 = obj1;

 

        obj1.a += 1;

        obj1.b += 1;

 

        System.out.println ("values of obj1 : ");

        obj1.print();

        System.out.println ("values of obj2 : ");

        obj2.print();

 

    }

}
1.

values of obj1 :

a=11,b=21

values of obj2:

a=11 b=21

2.

values of obj1 :

a=11,b=21

values of obj2:

a=10 b=20

3.

compiler error

4.

runtim error

9.

Predict the output of following Java program

class Test {
  int i;
}
class Main {
  public static void main(String args[]) {
      Test t = new Test();
      System.out.println(t.i);
   }
}
1.
garbage value
 
2.
0
 
3.

compiler error

4.

runtime error

10.

Predict the output of following Java program?

class Test {
  int i;
}
class Main {
   public static void main(String args[]) {
     Test t;
     System.out.println(t.i);
1.

0

2.

garbage value

3.

compiler error

4.

runtime error

Worksheets by UrbanPro

A little About Us

Our worksheets are designed to help students explore various topics, practice skills and enrich their subject knowledge, to improve their academic performance. Designed by Experts who have extensive experience and expertise in teaching a subject, these worksheets will improve your child's problem-solving skills and subject knowledge in a fun and interactive manner.
Check out our free customized worksheets across school boards, grades, subjects and levels of subject knowledge. You can download, print and share these worksheets with anyone, anywhere, anytime!

Get a custom worksheet to practice!

Select your topic & see the magic.

subject

Select a subject*

Core Java Hibernate J2EE JSP JSP (Java Server Pages) Servlet Spring Struts Struts Web services

Please select another category

Select Chapter(s)

Chapters & Subtopics

Advanced»

Select type of questions

Select the length of worksheet

Questions (5 to 100)

No of questions have to be between 5 to 100