aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Programming Fundamentals
  • What is the output of the above program? public class Sss...
Multiple choice

What is the output of the above program?

public class Sss
{
public static
void main(String args[])
 {
 byte a=127; a++;
 System.out.println(a);
 }
}

  1. 127

  2. 0

  3. 128

    • 128
  4. Compilation error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Byte ranges from -128 to 127. So, when we increment after 127, it will give -128.

Keep practicing — related questions

  • What will be output of following code ? 1 public class Main { 2 public static void main(String[] args) { 3 ...
  • What is the output of following. public static void main(String[] args) { int b=3; byte c=b/2; System.out.p...
  • What is the output of the following code when compiled and run? Select one correct answer. public class Que...
  • What will be the output of the following code? class Shift { public static void main(String arg[]) { int a=...
  • What is the output of following. public static void main(String[] args) { final int b=3; byte c=b/2; System...
  • What will be the output of the below code snippet? public class Quiz10 { public static void main(String arg...
  • What will be the output of the program? class SC2 { public static void main(String [] args) { SC2 s = new S...
  • What will be the output of the program? class Test { public static void main(String [] args) { int x=20; St...
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy