JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
public class Program
{
public static void main(String[] args) {
byte a=10;
float b;
int c;
b=(float)++a*a;
c=(short)b;
System.out.println(a++ + ++b +.1);
System.out.println(b +.1);
System.out.println(c +.1);
}
}
which of the following Exception is thrown by Jvm when code uses negative size while initializing an array
Anonymous Quiz
25%
NullPointerException
12%
NumberFormatException
25%
IllegalArgumentException
37%
NegativeArraySizeException
public class Program
{
int i;
int j;
int k;
Program(){
j=2;
}
Program(int m,int n){
super();
i=m;
k=n;
}
Program(int x){
super();
j=x;
}
public static void main(String[] args) {
Program p=new Program(4);
System.out.println(p.i+" "+p.j+" "+p.k);
}
}
Which of the below is bidirectional cursor in Collection (JAVA)?
Anonymous Quiz
6%
Iterator
23%
Enumeration
44%
ListIterator
27%
All the above
Q. You want subclasses in any package to have access to members of a superclass. which is the most restrictive that accomplishes this objective?
Anonymous Quiz
25%
Private
39%
Public
10%
Transient
25%
Protected
Q. If an unique key constraint on DATE column is created will it accept the rows that are inserted with SYSDATE?
Anonymous Quiz
59%
Will
41%
Won't
What is the Result of the following 'VIK'||NULL||'RAM' ?
Anonymous Quiz
19%
Error
19%
NULL
37%
VIKRAM
24%
VIK RAM
public class Main
{
public static void main(String[] args) {
int num1,num2;
try{
num1=0;
num2=62/num1;
System.out.println("Try block message");
System.exit(0);
}catch(ArithmeticException e){
System.out.println("Error: Don't divide a Number of num1");
System.exit(0);
}
finally{
System.out.println("Give another number of num1");
}
}
}
public class Main
{
static final Integer i1=1;
final Integer i2=2;
Integer i3=3;
public static void main(String[] args) {
final Integer i4=4;
Integer i5=5;
class Inner{
final Integer i6=6;
Integer i7=7;
Inner(){
System.out.println(i6+i7);
}
}
}
}
public class Main
{
public static void main(String[] args) {
String s1="JAVA";
StringBuilder s2=new StringBuilder(s1);
System.out.println(s1.compareTo(s2)==s2.compareTo(s1));
}
}
public class Main
{
public static void main(String[] args) {
int i=0;
addTwo(i++);
System.out.println(i);
}
static void addTwo(int i){
i+=2;
}
}
Options
Anonymous Quiz
9%
0
16%
1
35%
2
40%
3
public enum TrafficLight
{
RED("Stop"),YELLOW("Caution"),GREEN("Go");
private String action;
TrafficLight(String action){
this.action=action;
}
public static void main(String[] args) {
TrafficLight green=new TrafficLight("Go");
System.out.println(GREEN.equals("green"));
}
}