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

Android

Sam Moschler
Sam Moschler
2,193 Points

Trying to incorporate IntelliJ IDEA & losing my mind!!

Okay, I wanted to take some of the things we're learning in the Android course, and create my own versions to practice, but I can't get it to work. I've even copied and pasted directly from the teacher's WorkSpace, and all I get are errors. >_<

I don't understand the whole ordeal with console.printf vs System.out.println.

I don't understand why what I'm learning doesn't work when I try to use it.

I don't understand the closest thing I could find to an answer so far on this forum, which dealt with adding BufferedReader stuff to the code and changing all of the i/o code that worked in TreeHouse's WorkSpace.

Heck, I don't even understand the majority of what I just typed! I was on a high from completing lesson 3 and feeling like, "Yes! I get it! I can make Mad Libs! It all makes sense!"........... then I try it in an IDE and it's like, "Wait...no....NOOOOO.... Great, now I'm completely lost."

I've been Googling it for an hour...it's just more stuff I don't understand, which is frustrating because I could have spent that hour here learning. Why doesn't IDEA recognize the code that works here? How can I fix it? I'm a beginner, and I'm just trying to understand what I'm missing. Please help clear some of this up for me - it all just turned so confusing!

EDIT: Here's my last attempt....it ended in another flood of errors :(

<p>
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Mad_Libs

{

    public static void main(String[] args)
    {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        /*  Some terms:
            noun - Person, place or thing
            verb - An action
            adjective - A description used to modify or describe a noun
            Enter your amazing code here!
        */

        //__Name__is a __adjective__ __noun__.  They are always __adverb__ __verb__.

        System.out.println("Enter a name:  ");
        String firstName = reader.readLine();
        System.out.println("Enter an adjective:  ");
        String adjective = reader.readLine();
        System.out.println("Enter a noun:  ");
        String noun = reader.readLine();
        System.out.println("Enter an adverb:  ");
        String adverb = reader.readLine();
        System.out.println("Enter a verb ending with -ing:  ");
        String verb = reader.readLine();

        System.out.println("%s is a %s %s. They are always %s %s.", firstName, adjective, noun, adverb, verb);
    }
}
</p>

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Sam;

I understand the frustration, both as a beginner and attempting to utilize IntelliJ as an IDE for the Java courses here at Treehouse. The issue is kind of a combination of factors. The courses cover the Console class for input and output. It is simple, clean, and works well in console environments. However, IntelliJ does not implement a console component into it's IDE, so one cannot use those commands.

So, what to do? There is a Scanner class in Java that functions similarly to the Console class that can be used in IntelliJ. A little research on Google and you should be headed in the right direction for migrating your code over. If you have specific issues, please post your code here on the forum and help will be forthcoming, I'm sure.

It is great to hear that you are trying to advance your learning on your own! Some of our best learning comes from such actions. However, at this point, to move along with the courses I would recommend sticking with Workspaces or running the java code directly from the command line on your own machine, assuming you have the java compiler, etc. setup on your machine. :smile:

Post back with further questions and happy coding.

Ken

Sam Moschler
Sam Moschler
2,193 Points

Thanks for the quick feedback. I'll look into the Scanner stuff tomorrow for sure. I think I'm the most confused about what a console component really is. I am understanding how to USE the code here, I just don't understand why it doesn't work on the IDE. What is the difference in the two? As a beginner, I thought I should get to learning an IDE asap, the code completion options and color schemes are incredibly helpful. What are they using instead of console, and why? Why and when should you choose to use one over the other? Why did Treehouse choose this method over what works on IDE? I'm sorry for the litany of questions... It's just hard to wrap my head around.

I've added my code that I was messing around with, but to be perfectly honest, I got totally lost and it now seems completely foreign to what worked so simply and well on Workspaces. I don't know what the BufferedReader or any of that stuff actually is, I was just trying to make it work.

Here is the error code:

<p> Error:(35, 19) java: no suitable method found for println(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) method java.io.PrintStream.println() is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(boolean) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(char) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(int) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(long) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(float) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(double) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(char[]) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(java.lang.String) is not applicable (actual and formal argument lists differ in length) method java.io.PrintStream.println(java.lang.Object) is not applicable (actual and formal argument lists differ in length) </p>

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Sam;

Great questions! Some of those I think would best be answered by Craig Dennis.

In terms of wanting to move on to working in an IDE, I understand the appeal but I think that learning how to code properly without all the bells and whistles an IDE provides is best. Once the basics concepts are firmly established then we get treated to an IDE. Just my thoughts.

Ken