This is how variables are to be printed in the Java program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The number is 5. | |
It can also be written as this 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Variables { | |
public static void main(String[] args) { | |
int i=5; | |
System.out.print("The number is "); | |
System.out.print(i); | |
System.out.println("."); | |
System.out.print("It can also be written as this "+i); | |
} | |
} |
No comments:
Post a Comment