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 Introduction to Your Tools

Siddhartha Dutta
Siddhartha Dutta
4,609 Points

console.printf() wants two arguments. Otherwise it is giving me error. Why ?

My Code:

import java.io.Console;

public class Introductions {

     * @param args
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Console console = System.console();
        console.printf("Hello I am Sid");

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    The method printf(String, Object[]) in the type Console is not applicable for the arguments (String)

    at Introduction s.main(Introductions.java:12)

2 Answers

Hi Sid,

That is strange. I copied your code and it worked for me. How are you compiling it?

Siddhartha Dutta
Siddhartha Dutta
4,609 Points

Hi Frank, Thank you for your valuable reply. Yes the problem was in my environment variables somewhere and my system was messed up. So I again fully setup my system and now it is working fine. Basically it was compiling problem.

Good to hear! You're welcome!