Discussion
What will be the output of the program ?
public class Test
{
public static void main(String [] args)
{
signed int x = 10;
for (int y=0; y<5; y++, x--)
{
System.out.print(x + ", ");
}
}
}
Answer: C
Correct answer: Compilation fails.
Java has no signed keyword. Its integral types are signed by definition - there is no unsigned counterpart to declare against - so the word is not part of the language and signed int x = 10; is rejected. It is a C and C++ construct, and the same applies to unsigned. Nothing runs, so neither of the printed sequences arises.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development