Logo

Java Questions Set 241:

Quiz Mode

getMessage() methods return description of an exception 

1
2

Solution:

Which of the following is not an access modifier?

1
2
3
4

Solution:

An abstract class defines only the structure of the class not its implementation 

1
2

Solution:

for Interface 

1
2
3
4

Solution:

 Two or more methods with the same name can be differentiated on the basis of their parameters data type 

1
2

Solution:

How can we delete all files in a directory?

1
2
3
4

Solution:

What is the default encoding for an OutputStreamWriter?

1
2
3
4

Solution:

Which of the following methods is not used for Serialization and Deserialization?

1
2
3
4

Solution:


public class program{

public static void main(String args[]){

String str1="234";

String str2="4534";

long l1=Long.parseLong(str1);

long l2=Long.parseLong(str2);

long sum=0;

sum=l1+l2;

String str3=Long.toString(sum);

if(str1.length()==str3.length()){

System.out.println(str3);}

else{

System.out.println(str1);

    }

  

}//main end

}//class end

1
2
3
4

Solution: