Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1
    AdamCCFC is offline Member
    Join Date
    Jul 2008
    Posts
    1
    Rep Power
    0

    Default System.out.println Shortcut

    Hi,
    Im using Netbeans 6.1, and I was wondering what the shortcut to get System.out.println("") was?? :confused:

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    6

    Default

    I dont know any shortcut but i use this to speed it up.

    Type "Sys" then Ctrl+space enter
    followed by ".o" then Ctrl+space enter
    then ".p" then ctrl+space click println(); ^_^

    Or sometime i just put it in my clipboard then paste it whenever i need it ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Yes, as far as I know Ctrl+Space is the simplest way to do it. There is no any other shortcut for that.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    I'm sorry but this one

    Quote Originally Posted by Eku View Post
    ".o" then Ctrl+space enter
    is not exactly a shortcut as that is 5 keystrokes and ".out" is four. ;)

    Just thought I'd point that out. ;)

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  6. #6
    Jkarretero is offline Member
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Thumbs up Solution

    The shortcut is sout + Tab.
    This is, write 'sout' and then press 'Tab' key.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Jkarretero View Post
    The shortcut is sout + Tab.
    This is, write 'sout' and then press 'Tab' key.
    On what IDE this is working? Not in NetBeans.

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Most IDEs allow you to create your own short-cuts. So with Eclipse's Templates, I've created many, including SOP for System.out.println(...).

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Yes it's true. But the mess-up is that Jkarreteros' post. The way he/she explain give influence that it's a standard shortcut on an IDE. That's why I confused. :)

  10. #10
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    sout<space> is a standard shortcut in NetBeans 5.5 and 6.1.

    You can also
    Java Code:
    import static java.lang.System.out;
    and use
    Java Code:
    out.println("...");
    db
    Last edited by DarrylBurke; 04-07-2009 at 09:00 PM.

  11. #11
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    I've come quite accustomed to using snippit on linux. It's a text expander with scripting capabilities.
    I have
    Java Code:
    prntln#var
    where var gets placed into
    Java Code:
    System.out.println("var");
    I use it for javadoc and search engines (along with FF keywords) too.

    For windows I believe texter is a descent text expander.

    As for netbeans specific, go to tools->options->editor->code templates. You can add your own templates, just type in the abbreviation and press tab directly after and the abbreviation will be expanded.

    Hope that helps you some,

    automater

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Darryl.Burke View Post
    sout<space> is a standard shortcut in NetBeans 5.5 and 6.1.
    I'm working on NetBeans 6.5 and this is not working. Can you clear-up more. How did you use the space key, with any other key combination?

  13. #13
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    I have resorted in the past to creating a class called 'o' (yes, this violates convention, but who cares), with a single static member, also called 'o'.

    System.out.println then becomes 'o.o'. I wouldn't use it for production code, but then, I wouldn't use System.out.println for production code either.

  14. #14
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Quote Originally Posted by Eranga View Post
    I'm working on NetBeans 6.5 and this is not working. Can you clear-up more. How did you use the space key, with any other key combination?
    No, nothing special. Just press s,o,u,t,space which expands to
    Java Code:
    System.out.println("");
    Maybe it was dropped from version 6.5, or possibly you deleted some of the pre-loaded shortcuts? In any case, it's easy to add it back.

    db

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Darryl.Burke View Post
    No, nothing special. Just press s,o,u,t,space which expands to
    Java Code:
    System.out.println("");
    Maybe it was dropped from version 6.5, or possibly you deleted some of the pre-loaded shortcuts? In any case, it's easy to add it back.

    db
    Ah, it's all about auto-complete I guess.

  16. #16
    hablutzel1 is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default shortcuts are called Code Templates in Netbeans 6.5

    You can activate code templates (or create new ones) in :


    Tools > Options > Editor > Code Templates in Netbeans 6.5

    I can add that if you use the emacs key keymap, TAB won't work for autocompletion, you can change the key-shortcut here:

    Tools > Options > Editor > Code Templates


    at the bottom, there are predefined shortcuts for almost any java sentence

  17. #17
    faisalhameed is offline Member
    Join Date
    Jan 2010
    Location
    Lahore
    Posts
    5
    Rep Power
    0

    Default

    You can use sout + Tab in netbeans and
    Sysout then Ctrl + Space in eclipse.

  18. #18
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Quote Originally Posted by faisalhameed View Post
    You can use sout + Tab in netbeans and
    Sysout then Ctrl + Space in eclipse.
    Thank you for that gem of knowledge. It's surprising that nobody mentioned that in the more than one year since the question was posted.

    Oh, wait, it's been mentioned more than once. Maybe it's just that you can't read.

    db

  19. #19
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    Been a bad day DB? ;-)

    (Not that I disagree, of course.)

  20. #20
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Page 1 of 2 12 LastLast

Similar Threads

  1. System.out.println
    By sunjavaboy in forum Advanced Java
    Replies: 3
    Last Post: 03-22-2008, 01:30 AM
  2. shortcut of System.out.println() without netbeans
    By VipinKeshri in forum New To Java
    Replies: 1
    Last Post: 11-18-2007, 09:24 AM
  3. Eclipse - shortcut to System.out.println
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-07-2007, 04:21 PM
  4. System.out.println shortcut
    By ravian in forum Eclipse
    Replies: 2
    Last Post: 11-07-2007, 10:17 AM
  5. Help me with system.out.println
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •