What is the output of this program?
1.class area {
2.int width;
3.int length;
4.int volume;
5.area() {
6.width=5;
7.length=6;
8.}
9.void volume() {
1o.volumewidth*length*height;
11.}
12.}
13.class cons_method {
14.public static void main(String args[])
15.{
16.area obj = new area();
17.obj.volume();
18.System.out.println(obj.volume);
19.}
20}
What is the process by which we can control what parts of a program can access the members of a class?
In below code, what can directly access and change the value of the variable name?
1.package test;
2.class Target
3.{
4.public String name = "hello";
5.}
Which of these keywords is used to make a class?
Which right shift operator preserves the sign of the value?
Which of these data type is returned by every method of OutputStream?
What is the output of this program? 1.class A {
2.int i;
3.}
4.class B extends A {
5.int j;
6.void display() {
7.super.i = j + 1;
8.System.out.println(j + " " + i);
9.}
10.}
11.class inheritance {
12.public static void main(String args[])
13.{
14.B obj = new B();
15.obj.i=1;
16.obj.j=2;
17.obj.display();
18.}
19.}
Which of these is method for testing whether the specified element is a file or a directory?
What is the output of this program?
1.class String_demo {
2.public static void main(String args[])
3.{
4.int ascii[] = { 65, 66, 67, 68};
5.String s = new String(ascii, 1, 3);
6.ystem.out.println(s);
7.}
8.}
What is the output of this program? 1.class string_demo {
2.public static void main(String args[])
3.{
4.String obj = "I" + "like" + "Java";
5.System.out.println(obj);
6.}
7.}
What is the output of this program?
1.import java.util.*;
2.class Output {
3.public static void main(String args[]) {
4.ArrayList obj = new ArrayList();
5.obj.add("A");
6.obj.ensureCapacity(3); 7.System.out.println(obj.size());
8.}
9.}
Which of these method is a rounding function of Math class?
What is the output of this program?
1.class bitwise_operator {
2.public static void main(String args[])
3.{
4.int a = 3;
5.int b = 6;
6.int c = a | b;
7.int d = a & b;
8.System.out.println(c + " " + d);
9.}
10.}
Which of these method of Object class is used to obtain class of an object at run time?
Which of these selection statements test only for equality?
Which of the following method of Process class can terminate a process?
What is the output of this program?
1.class access{
2.public int x;
3.private int y;
4.void cal(int a, int b){
5.x = a + 1;
6.y = b;
7.}
8.void print() {
9.system.out.println(" " + y);
10.}
11.}
12.class access_specifier {
13.public static void main(String args[])
14.{
15.access obj = new access();
16.obj.cal(2, 3);
17.System.out.println(obj.x);
18.obj.print();
19.}
20.}
What is the output of this program?
1.class variable_scope {
2.public static void main(String args[])
3.{
4.int x;
5.x = 5;
6.{
7.int y = 6;
8.System.out.print(x + " " + y);
9.}
10.System.out.println(x + " " + y);
11.}
12.}
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.Long i = new Long(256);
4.System.out.print(i.hashCode());
5.}
6.}
Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?
What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.int volume;
6.void volume() {
volume = 7.width*height*length;
8.}
9.}
10.class Output {
11.public static void main(String args[])
12.{
13.box obj = new box();
14.obj.height = 1;
15.obj.length = 5;
16.obj.width = 5;
17.obj.volume();
18.System.out.println(obj.volume);
19.}
20.}
Which of these method of Object class can generate duplicate copy of the object on which it is called?
What is the output of this program?
1.class main_class {
2.public static void main(String args[])
3.{
4.int x = 9;
5.if (x == 9) {
6.int x = 8;
7.System.out.println(x);
8.}
9.}
10.}
Which of these interface is not a member of java.io package?
Which of these is returned by “greater than”, “less than” and “equal to” operators
What is the output of this program? 1.class Output {
2.public static void main(String args[])
3.{
4.boolean a = true;
5.boolean b = false;
6.boolean c = a ^ b;
7.System.out.println(!c);
8.}
9.}
Which of these class is used for operating on request from the client to the server?
What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.int volume;
6.void finalize() {
7.volume = width*height*length;
8.System.out.println(volume);
9.}
10.protected void volume() {
11.volume = width*height*length;
12.System.out.println(volume);
13.}
14.}
15.class Output {
16.public static void main(String args[])
17.{
18.box obj = new box();
19.obj.width=5;
20.obj.height=5;
21.obj.length=6;
22.obj.volume();
23.}
24.}
Which of these methods can be used to obtain set of all keys in a map?
What is the output of relational operators?
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
Which of these packages contain classes and interfaces used for input & output operations of a program?
Which of these class is used to encapsulate IP address and DNS?
Which of these can be overloaded?
Which of these methods is used to obtain value of invoking object as a long?
Which of these method of class StringBuffer is used to find the length of current character sequence?
Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.Integer i = new Integer(257);
4.float x = i.floatValue();
5.System.out.print(x);
6.}
7.}
Which of these is wrapper for simple data type float?
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws UnknownHostException {
4.InetAddress obj1 = InetAddress.getByName("cisco.com");
5.System.out.print(obj1.getHostName());
6.}
7.}