public class Test {
public static final int MIN = 1;
public static void main(String[] args) {
int x = args.length;
if (checkLimit(x)) {
System.out.println("Java SE");
} else {
System.out.println("Java EE");
}
}
private static boolean checkLimit(int x) {
return (x >= MIN) ? true : false;
}
}
Tested in compiler and command line
https://www.programiz.com/java-programming/online-compiler/
java -cp /tmp/EB79LfiRf0 Test
Java EE
java -cp /tmp/EB79LfiRf0 Test 1
Java SE
The right answer is the letter A, because in the command line passed the argument 1, that is, the String "1" is in the 0 place of the list with the indexing, but the list has size 1, so it is True printing " Java SE". If you take the raw code and play it in the IDE, it will print the letter B, but remembering that the args array is a list with no arguments and the argument "1" was passed to the console.
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
amit_lad88
3 days, 21 hours agofvelazqueznava
2 months agosomrita90
3 months, 2 weeks agoSreeni_A
3 months, 4 weeks agoakbiyik
1 year agocarloswork
1 year, 1 month agoiSnover
1 year, 2 months ago