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 trialmos per
Courses Plus Student 1,172 PointsI'm using bluej as my work space. why wont bluej work with console.printf method?
help
mos per
Courses Plus Student 1,172 PointsI imported and created everything necessary. Still no luck.
1 Answer
lambda
12,556 PointsFor BlueJ IDE, instead of "console.printf()", you can use "System.out.printf()" or "System.out.println()".
In my opinion those are much easier and have fewer problems than using a Console object.
mos per
Courses Plus Student 1,172 PointsYea. But what can I do in stead of console.readLine().
Also: WHY is console not working in bluej?
lambda
12,556 PointsYou didn't post any source code, so it is impossible for us to see what you are doing wrong.
Another way to get input from the console is the use a Reader:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class MyClass {
...
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
System.out.println("You typed into the console: " + input);
...
}
Carlos Federico Puebla Larregle
21,074 PointsCarlos Federico Puebla Larregle
21,074 PointsAre you importing the "java.io.Console;" and making an instance of that class? like:
Console console = System.console();
So that you can use the variable "console" to print in a formatted way, if not that may be the problem.
I hope that helps you a little bit.