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 Local Development Environments Exploring Your IDE Clean up this mess

sout shortcut

In the Cleaning up this Mess Challenge he asks up to use the "sout shortcut" but I cannot find what he is talking about.

Messy.java
import java.util.*;

public class Messy {
    public   static void main(String[]      args){
System.out.println("five");System.out.println("one");
    System.out.println("six");
    System.out.println( "four"       );     System.out.println("two");
    Please comment out this line and
    this line as well with a hotkey that does multi-line commenting
    List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
    for (String numberWord:         numberWords) {
      // Use the sout shortcut to write out numberWord;
      }
    }}
results.txt
import java.util.*;

public class Messy {
    public   static void main(String[]args){
    System.out.println("one");
    System.out.println("two");
    System.out.println("three");
    System.out.println("four");
    System.out.println("five");
    List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
    /*Please comment out this line and
    this line as well with a hotkey that does multi-line commenting*/
    for (String numberWord: numberWords) {
      // Use the sout shortcut to write out numberWord;
      }
    }}

3 Answers

Kourosh Raeen
Kourosh Raeen
23,733 Points

From the File menu go to Settings > Editor > General > Postfix Completion. Make sure "Enable postfix completion" is checked. Also, from the list, make sure that Java and sout are checked. In my IDE all of the are checked.

Thanks for your help Kourosh, but it didn't work. All of the tabs were checked and I even did a restart of InteliJ IDEAS and tried typing "sout" then clicking on the TAB button. Nothing. Could I be in the wrong project? The last 3 tabs at the top show ".idea/copyright/Messy" I just checked and I'm not even getting spellchecking.

Kourosh Raeen
Kourosh Raeen
23,733 Points

That's weird! It shouldn't depend on the project. In the same settings window that I told you above there is an option for how the template expands. Mine says: Expand templates with Tab, but there are a couple of other options in that drop-down menu. Change it to Space or Enter, and then back in the java file type sout and then hit space or enter on the keyboard, whichever you chose in the settings, and see if it works.

Kourosh Raeen
Kourosh Raeen
23,733 Points

Instead of typing System.out.println(); you can just type sout and then press the tab key.

It isn't working. Is it possible that I have somehow disabled or not activated my shortcuts?

Sorry for the delay Kourosh. I am so frustrated with this course, I am very tempted to quit. I couldn't get the sout or any of the others listed in the "Postfix Completion" tab to work. Well, I'll cheat for now and hope it somehow comes back. Thanks for the help.