• Write a program to print a semicolon without using a semicolon anywhere in the code in java.
  • Write a program to print"hello world"without using semicolon anywhere in the code.\
  • Yes we can print ";" without using semicolon in java by using printf in java.
  • Format text using printf in java here we have provided information about how to format text using printf in java.
  • In the same way we can print ";" using printf .
  • ASCII value for ";" is 59. So if we print 59 in character format it will print ;
  • System.out.printf("%C",59).
  • But in java program end of every statement we need to keep ";". To eliminate this we can use if condition.
  • Keep print statement inside if condition and it will print the ";" now.
  • Now let us see an example java program to print a semicolon without using a semicolon anywhere in the code in java.


Program #1: Write a program to print a semicolon without using a semicolon anywhere in the code in java 


  1. package instanceofjava;
  2. /**
  3.  * Print semicolon without using semicolon in java
  4.  * Print hello world without using semicolon java program code
  5.  * @author www.instanceofjava.com
  6.  */
  7. public class PrintSemiColon {
  8.     
  9. public static void main(String[] args) {
  10.     
  11.     if(System.out.printf("%C",59) != null){
  12.         
  13.     } 
  14.     
  15. }
  16. }

Output:

  1. ;


Program #1: Write a program to print hello world without using a semicolon anywhere in the code in java

  1. package instanceofjava;
  2. /**
  3.  * Print semicolon without using semicolon in java
  4.  * Print hello world without using semicolon java program code
  5.  * @author www.instanceofjava.com
  6.  */
  7. public class PrintSemiColon {
  8.     
  9. public static void main(String[] args) {
  10.     
  11.     if(System.out.printf("Hello World")!=null){
  12.         
  13.     }
  14.     
  15.     
  16. }
  17. }

Output:

  1. Hello World


print semilolon without semicolon

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu