Can the main() method in Java return any data?
Predict the output of the following Java code.
public class j{
public static void main(String args[]){
System.out.println(true ? 100:105.4);
}
}
Which Java package is used for handling security-related issues in a program?
class test {
public static void main (String[] args) {
int n=16;
n=arr[arr[arr[++n/2]]]/2;
System.out.println((double)arr[--n]/2);
}
}
class test{
public static void main (String[] args) {
double A[2];
int B=new int[2];
System.out.println(A[0]+" "+B[0]);
}
}
//Predict the output
import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
String str = "classMate";
char s2 = str.charAt(5);
System.out.println(s2);
}
}
1. class C
2. {
3. public static void main(String args[])
4. {
5. char c1 = 'E';
6. char c2 = 84;
7. c2++;
8. c1+=1;
9. System.out.println(c1 + " " + c2);
10. }
11. }
Which of these statements about multithreading and thread states is incorrect?
Predict the output of the following Java code:
import java.util.*;
import java.util.stream.IntStream;
class Abekus {
public static void main(String[] args) {
IntStream i = IntStream.concat(IntStream.of(2, 6, 10, 46),
IntStream.of(-2, -5, 3, 8));
boolean j = i.allMatch(n -> n > 0);
System.out.println(j);
}
}