Trying to make a very simple and basic file template
Answered
Okay I'd like to make what I call a very basic file template. Instead of always typing in public class .....
and public static void main(string args[]) plus those matching braces...
If I can make a basic template that would include that stuff it would save me time since that's the stuff I always type over and over.
But so far no luck. This seems a bit more difficult that using say EditPlus.
I've enclosed a screenshot of where I am in IntelliJ.
I want my template to have just this:
//
public class
{
public static void main (string args[])
{
}
}
Can you guide me through this?
Please sign in to leave a comment.
Use the default Class template as a base, add the main method so that it looks like this:
Use the New action on the Source root and select your template:
Type the class name in the dialog, for example Hello:
Also note that when using the default class template:
* it leaves the caret at a place where you can press Ctrl-Shift-Enter (aka "Complete Statement") to go to the next line (or add "extends ..." or "implements" first)
* you can then type "psvm" + TAB to have a live template create the main method (where "psvm" stands for "_p_ublic _s_tatic _v_oid _m_ain" so it is easy to remember)