What is the output of the following Java program?
Which of the following events is generated by a scroll bar?
class test{
public static void main (String[] args) {
int x=130;
byte b=(byte)x;
System.out.println(b);
}
}
class test {
public static void main (String[] args) {
int[][] arr=new int[][]{{0,1,2,3,4,5,6,7,8,9},{10,11,12,13,14,15,16}};
int n=2;
System.out.println((arr[--n][n*5])/10*2+3/10);
}
}
Predict the output.
class Abekus {
public static void main(String[] args)
{
int A[] = { 4, 7, 15, 20, 13 };
for (final int i : A)
System.out.print(i + " ");
}
}
What is the output of the following Java code?
class Abekus {
public static void main(String args[]) {
for (int k=0; k<40; k=k+3) {
if (k % 2 == 1)
System.out.print(k + " ");
}
}
}
What is the output of the following Java code?
public class Abekus {
public static void main(String[] args) {
int i = -2;
if (i) {
System.out.println("Hi, Rohan");
} else {
System.out.println("BYE");
}
}
}
import java.time.LocalTime;
public class Main{
public static void main(String args[]){
LocalTime time1 = LocalTime.of(10,20,30);
System.out.println(time1);
LocalTime time2 = time1.minusHours(2);
LocalTime time3 = time2.minusMinutes(15);
System.out.println(time3);
}
}
import java.util.*;
class output
{
public static void main(String args[])
{
HashSet obj = new HashSet();
obj.add("A");
obj.add("B");
obj.add("C");
obj.add("D");
obj.add("B");
obj.add("A");
System.out.println(obj + " " + obj.size());
}
}
Predict the output of the following Java code:
import java.lang.*; class Counter { int count; public void increment(){ count++; }}
public class Main{ public static void main(String args[]) throws Exception{ Counter c=new Counter(); Thread t1 =new Thread (new Runnable() { public void run(){ for(int i=1;i<=1000;i++) { c.increment(); }}});
Thread t2 =new Thread (new Runnable() { public void run() { for(int i=1;i<=1000;i++) { c.increment(); }}});
t1.start(); t2.start(); t1.join(); t2.join(); System.out.println(c.count); }}