Menu
Popular Courses
Search
Question


What is the output of this program?


class Output {
public static void main(String args[]) {
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])+ " ");
System.out.print(Character.isWhitespace(a[3])+ " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
Options:
A .  true false true
B .  false true true
C .  true true false
D .  false false false
Answer: Option B

Character.isDigit(a[0]) checks for a[0], whether it is  a  digit or  not, since a[0] i:e 'a' is 

a character false is returned. a[3] is a whitespace hence Character.isWhitespace(a[3]) 

returns a true. a[2] is an upper case letter i:e 'A' hence Character.isUpperCase(a[2]) 

returns true.
Output:
$ javac Output.java
$ java Output
false true true




Was this answer helpful ?
Next Question

Submit Comment/FeedBack

Your email address will not be published. Required fields are marked *

Share this page with your friends!

Latest Videos

Chapter 1 - GLOBAL STEEL SCENARIO & INDI Part 1 : (13-04-2024) INDUSTRY AND COMPANY AWARENESS (ICA)
Direction Sense Test Part 1 Reasoning (Hindi)
Chapter 1 - RMHP / OHP / OB & BP Part 1 : (14-02-2024) GPOE
Cube & Cuboid Part 1 Reasoning (Hindi)
Data Interpretation (DI) Basic Concept Reasoning (Hindi)
Counting Figures Part 1 Counting Of Straight Lines Reasoning (Hindi)
Real Numbers Part 7 Class 10 Maths
Real Numbers Part 1 Class 10 Maths
Polynomials Part 1 Class 10 Maths

Latest Test Papers

Chapter 3.1 : Overview of Finance & Acco Chapter 3 : Finance & Accounts SAIL E0 - GFM 2024
Chapter 2.1 : Overview Chapter 2 : Materials Management SAIL E0 - GFM 2024
Chapter 1.1 : Personnel Functions- An ov Chapter 1 : Personnel Management SAIL E0 - GFM 2024
GPOE / GPA Combined 1 Free CBT Mock Test SAIL E0 2024
CBT Mixed Test 1 GPOE/GPA SAIL E0 2024