You are on page 1of 2

1. What is the extension of Bytecode?

2. What is the size (width) of the primitive data type short?

3. What is the range of data type char?

4. What is the output of a Java Compiler?

5. Java is a platform independent programming language. Justify the statement.

6. Write a java program to find the sum of two integers where the inputs are passed as
command line arguments.
7. What is the responsibility of a constructor? (Any 1)

8. Define a parameterized constructor for the following class:


class Rectangle
{
int length;
int breadth;

9. Define Method Overloading.

10. Highlight the erroneous lines of code? Explain the reason for the errors.

Rectangle System.out.println(“Perimeter is”+p);


{ private int length; }
private int breadth; }
void setDimensions(int l, int b) Class RectangleDemo
{ length=l; {
breadth=b; public static void main(String args[ ])
} {
void getArea() Rectangle r1 = new Rectangle( );
{ int a=length*breadth; r1.length=5;
System.out.println(“Area is”+a); r1.setDimensions(7,3);
} r1.getArea();
private void getPerimeter() r1.getPerimeter();
{ }
int p=2*(length+breadth); }

You might also like