Development > Coding
Learning Java Programming on Linux
bitsnpcs:
I don't know how to write Java, have you tried changing -
--- Code: ---last;}
--- End code ---
change to
--- Code: ---last};
--- End code ---
Homework:
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:
--- Code: ---public String toString()
{
return first + " " + middle + " " + last;
}
Name myName = new Name("Cookie" + "Monster" + "Jr");
System.out.println("myName: " + myName.toString());
--- End code ---
Then I compiled the codes and here's what it's shown on the Terminal:
--- Code: ---mei@mei-Aspire-4750:~/Documents/java$ javac NameTest.java
mei@mei-Aspire-4750:~/Documents/java$ javac Name.java
mei@mei-Aspire-4750:~/Documents/java$ java NameTest
myName: CookieMonsterJr
--- End code ---
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?
Navigation
[0] Message Index
[*] Previous page
Go to full version