Search This Blog

Tuesday, July 29, 2025

Java Data types - 2

 Java is a strictly typed language. Unlike C, where the size of some data types is machine-dependent, Java has a fixed size and thus range for every type. Keeping the fact in mind that Java is a strictly typed language, what will be the output of the following code?

1. /**

 2.  *

 3.  * @author Nancy K.A.N.

 4.  */

 5. public class Datatype2Demo {

 6.     public static void main(String[] args) {

 7.         short x = 32768;

 8.         System.out.println("x = "+x);

 9.     }

10. }

11.  

 

Created by Nancy K.A.N.

@12:50 29-Jul-2025


No comments:

Post a Comment