File: p61.java

package info (click to toggle)
bock 0.20.2.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,228 kB
  • ctags: 1,370
  • sloc: ansic: 7,367; java: 5,553; yacc: 963; lex: 392; makefile: 243; sh: 90; perl: 42
file content (15 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Test {
        public static void main(String[] args) {
                short s = 12;           // narrow 12 to short
                float f = s;            // widen short to float
                System.out.println("f=" + f);

                char c = '\u0123';
                long l = c;             // widen char to long
                System.out.println("l=0x" + Long.toString(l,16));

                f = 1.23f;
                double d = f;           // widen float to double
                System.out.println("d=" + d);
        }
}