You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Learning Java Programming on Linux

Author (Read 23661 times)

0 Members and 1 Guest are viewing this topic.

Re: Learning Java Programming on Linux
« Reply #2 on: July 23, 2017, 06:05:37 AM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
I don't know how to write Java, have you tried changing -
Code: [Select]
last;} 
change to 
Code: [Select]
last};
« Last Edit: July 23, 2017, 06:34:11 AM by bitsnpcs »
 

Learning Java Programming on Linux
« Reply #1 on: July 23, 2017, 04:55:01 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
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: [Select]
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: [Select]
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?
« Last Edit: July 25, 2017, 10:48:45 AM by Homework »
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section