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.

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
2.
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

3.

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

4.

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

5.

Java program to read from text file line by line

1.

descriptive ans type

2.

--

6.

Write a program to print below given pattern

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

1.

descriptive ans type

2.

--

7.

How to reverse string in java (Use optimized code)?

1.

descriptive ans type

2.

--

8.

The List interface has which super interfaces?

1.

Both collection and Iterable

2.

collection

3.

Iterable

4.

None

9.

Which of the folowing is not a child interface of Collection?

1.

List

2.

Set

3.

Map

4.

Queue

10.

Which of the following can be the reason for memory leaks?

1.

ThreadLocal variables

2.

Mutable keys of collection implementations

3.

Both 1 and 2.

4.

None of the above.

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