07-24-2017, 05:33 PM
Hello, I'm new to Linux Lite OS and programming.
At the moment, I'm learning Java programming from a course at Udemy and I've encountered a
problem with empty spaces in outputs.
Here's part of the codes:
public String toString() { return first + " " + middle + " " + last; }Name
myName = new Name("Cookie" + "Monster" + "Jr");System.out.println("myName: " +
myName.toString());
Then I compiled the codes and here's what it's shown on the Terminal:
mei@mei-Aspire-4750:~/Documents/java$ javac
NameTest.javamei@mei-Aspire-4750:~/Documents/java$ javac
Name.javamei@mei-Aspire-4750:~/Documents/java$ java NameTestmyName: CookieMonsterJr
All the spaces are appearing right before the name. I'm using Linux's Text Editor. Could
this the reason why the codes are not working properly?
At the moment, I'm learning Java programming from a course at Udemy and I've encountered a
problem with empty spaces in outputs.
Here's part of the codes:
public String toString() { return first + " " + middle + " " + last; }Name
myName = new Name("Cookie" + "Monster" + "Jr");System.out.println("myName: " +
myName.toString());
Then I compiled the codes and here's what it's shown on the Terminal:
mei@mei-Aspire-4750:~/Documents/java$ javac
NameTest.javamei@mei-Aspire-4750:~/Documents/java$ javac
Name.javamei@mei-Aspire-4750:~/Documents/java$ java NameTestmyName: CookieMonsterJr
All the spaces are appearing right before the name. I'm using Linux's Text Editor. Could
this the reason why the codes are not working properly?