See the Security and Bug Fixes Section - Grub EFI Install Updates Fix Sticky


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learning Java Programming on Linux
#1
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());

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

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?
Reply


Messages In This Thread
Learning Java Programming on Linux - by Homework - 07-23-2017, 08:55 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)