The version of Java I'm using with Linux is:
- openjdk version "16.0.2" 2021-07-20
- OpenJDK Runtime Environment (build 16.0.2+7)
- OpenJDK 64-Bit Server VM (build 16.0.2+7, mixed mode)
This is the code I used to compile from the Head-First Java book:
public class DooBee {
public static void main(String[] args) {
int x = 1;
while (x < 3) {
System.out.print("Doo");
System.out.print("Bee");
x = x + 1;
}
if( x == 3) {
System.out.print("Do");
}
}
}
I compiled it as such:
javac DooBee.java
java DooBee
This is the output:
DooBeeDooBeeDo%
Why is that special character(%) present at the end of the string and how do I write my code to get rid of it?