The Artima Developer Community
Sponsored Link

Java Buzz Forum
Print semicolon without using semicolon in java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
Print semicolon without using semicolon in java Posted: Jun 10, 2017 3:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: Print semicolon without using semicolon in java
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement
  • 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

Read: Print semicolon without using semicolon in java

Topic: The Best Programming Languages for Each Situation Previous Topic   Next Topic Topic: Java Interview Programs for Freshers

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use