Java Java Basics Getting Started with Java Strings and Variables

Fabiyan Adell
Fabiyan Adell
315 Points

Not desired output

Hello, I'm trying print out "Hello, my name is Tiger"Tiger is learning how to write Java"); but it only outputs "Hello, my name is Tiger" Can anyone help what's wrong with my code? Thanks in advance

import java.io.Console;

public class Introductions {

public static void main(String[] args) {
    Console console = System.console();
    // Welcome to the Introductions program!  Your code goes below here
    console.printf("Hello, my name is Tiger");
    console.printf("Tiger is learning how to write Java");

}

1 Answer

Tonnie Fanadez
Tonnie Fanadez
UX Design Techdegree Graduate 22,350 Points

Hello Tiger Han

Java is an interesting language to learn and I am sure you will love it. By the way, I like your Tiger Avatar!! looks cute.

So I checked your code and found it was working alright. The only thing that you might have missed is saving your work.

You can also use \n on the first line to make the second line drop to a new line for easy readability.

import java.io.Console;

public class Introductions {

public static void main(String[] args) {
    Console console = System.console();
    // Welcome to the Introductions program!  Your code goes below here
    console.printf("Hello, my name is Tiger \n");
    console.printf("Tiger is learning how to write Java");

Hope this helps.

Thanks,