javaofflinesample
javaofflinesample
SECTION A
1. 2)
a) Why JAVA is called platform independent language?
(5)
b. What are the features of Java programming languag?
code: (2x4)
d Give output ofthe following
i public class A
public static voidmain(String args[ })
String sl = "abc";
"
s2 "ghi"
System.out.println(s1 + s2 + s3);
(2.)
Boolean bl =
new Boolean("false");
boolean b2:
b2 b1.boolean Value():
if(!b2)
b2 true
System.out.print("x ");
System.out.print("y "):
System.out.println("z");
.
ii. public class X
try
badMethod()
System.out.print("A"):
System.out.print(B");.
finally
System.out.print("C");
System.out.print("D");
iv. classA
static int s;
public static void main(String args[ })
void start()
int x= 7;
twice(x);
System.out.print(x + " ");
void twice(int x)
x x*2;
e) How will JAVA handBe convérsion between two incompatible primitive data
types?ExpBain with Example.. (4)
f What are the several type promötion rules that apply to expressions?
.
(2)
g) What is the purpose of the unsigned right shift operator? Give Example (2)
cass B extends A { }
(u)
A a = new B():
System.out.println("complete"):
ii. class A
static int X,
boolean catch()
R
Xt+;
return true;
x=0;
if(catch()|catch()) || catch())
Xt+;
System.out.println(x);
ii. class P
ry
int a=0;
intb-21/a:
catch(Exception e)
catch(ArithmeticException e)
);
System.out.println( "Finally exception catch"
(5)
iv. class Q
byte x = 50;
byte y = 50;
byte z = 100;
y =y 2;
int g =X y/z;
SECTION B
(3)
concepts example.
with
2. a) Explain the oops (4)
b) What is the use of super keyword? Give Example
two different
(1+2)
List the
c) What is Multithreaded programming?
types of multitasking
(5)
between final, finally and finalize?
3. a) What are the difference (3)
and Unboxing?
b) Define Autoboxing (2)
cass?
c) Define Type Wrapper
(1+2)
the ambiguities that can arise
by varags? VWhat
are
4 a) What do you.mean method?,
. when we overload the varags .
class with
methods. where distance
to reate a distance
b): Write a program make
of feet and inehes.ceate object ofclass and
is computed in terms
use of this pointer. (2)
c) Define Annotations
(2x3)
the following
5. a) Differentiate between
throws
i. throw and
Interface
ii. abstract and (4)
four of them.
Unchecked Exceptions? List any
b) What are
(5)
Explain with a help of an example. (5)
Chained Exception. switch takes place
6. a) Define determine when will a context
the rules that
b) List and expBain
(6)
Class B extends A
Class C extends A
Class D extends A
Class MyClass
public void methodB)
obj2.methodA();
obj3.methodA0;