We take a integer variable and assign it a value of fifty nine. Now with the help Implicit Casting we convert this integer value into char and since ASCII value of semicolon(;) is fifty nine we get the output as semicolon.
Here is the source code of the Java Program to Print a Semicolon without using a Semicolon anywhere in the Code. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
public class Semicolon
public static void main(String args)
n = 59;
a = (char) n;
$ javac Semicolon.java $ java Semicolon ;
Sanfoundry Global Education & Learning Series – 1000 Java Programs.