This is a Java Program to Print a Semicolon without using a Semicolon anywhere in the Code.
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.
import java.util.Scanner;
public class Semicolon
{
public static void main(String[] args)
{
int n;
char a;
n = 59;
a = (char) n;
System.out.println(a);
}
}
Output:
$ javac Semicolon.java $ java Semicolon ;
Sanfoundry Global Education & Learning Series – 1000 Java Programs.
advertisement
advertisement
Here’s the list of Best Books in Java Programming, Data Structures and Algorithms.
If you find any mistake above, kindly email to [email protected]Related Posts:
- Check Programming Books
- Apply for Java Internship
- Practice Programming MCQs
- Check Java Books
- Practice BCA MCQs