This program is from the book Decompiling Java, chapter 1.
public class Casting {
    public static void main(String args[]){
        for(char c=0; c < 128; c++) {
            System.out.println("ascii " + (int)c + " character "+ c);
The only real trick here is the cast to integer in the call to println, although it would be nice for the decompiler to type for loop variable (here c) as a char rather than as an integer.

It's surprising how many decompilers fail this simple test.

-- MikeVanEmmerik - 13 Feb 2003

Revision: r1.2 - 13 Feb 2003 - 22:17 - MikeVanEmmerik
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback