Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Basics Getting Started with Java Strings, Variables, and Formatting

abdulkadir akti
abdulkadir akti
46 Points

how to use work place

I could not find any information to see how to use console

Name.java
// I have setup a java.io.Console object for you named console
 public class  java.io.Console {

   public static void main (String [] args){
     String ak = sananeolum ;

     System.out.printf(" ben kimim %s\n", ak);
   }

2 Answers

Manish Giri
Manish Giri
16,266 Points

Try these steps -

  1. Click on "Launch Workspace"
  2. If your workspace corresponds to one of the lecture videos, there should be some .java files in the sidebar. Double click to open it.
  3. Go to "View", then click "Show console" to pull up the console at the bottom. By default, it should already open up, unless you've closed it earlier.
abdulkadir akti
abdulkadir akti
46 Points

can you tell me by looking at picture what i am doing wrong

Manish Giri
Manish Giri
16,266 Points

If you're doing the "String, Variables and Formatting" challenge, you shouldn't need to set up your own class.

Just follow what the challenge task in the instructions say. Example, the first one says -

Define a string variable named firstName that stores your name. Set the value to your name.

So all you need to do is create a firstName variable of type String, and store your name in it.

If you're working in the workspace instead, then you need to fix your class name first. In your code, you have -

 public class  java.io.Console {

This is somewhat wrong. Your classname should be the same as your filename. And java.io.Console is importing Console from the java.io package. Those are two different things.

Example - if your file is Test.java, your class name would be Test. All your code would go in there -

// Test.java -

import java.io.Console;

public class Test {

    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 Craig");
  }
}