You can reduce the number of keystrokes when you are typing code by
typing abbreviations to generate code from templates. The abbreviation
is expanded into the template after you type a space. Code templates
also appear when you use code completion
while editing Java files.
The IDE comes with a set of code templates. You can also create your own
code templates.
Below is the list of
code templates that the IDE provides by default.
| Abbreviation |
Code Template |
| En |
Enumeration |
| Ex |
Exception |
| Ob |
Object |
| Psf |
public static final |
| Psfb |
public static final boolean |
| Psfi |
public static final int |
| Psfs |
public static final String |
| St |
String |
| ab |
abstract |
| bo |
boolean |
| br |
break |
| ca |
catch ( |
| cl |
class |
| cn |
continue |
| df |
default: |
| dowhile |
do {
} while (condition); |
| eq |
equals |
| ex |
extends |
| fa |
false |
| fi |
final |
| fl |
float |
| forc |
for (Iterator it = collection.iterator(); it.hasNext();) {
Object elem = (Object) it.next();
} |
| fore |
for (Object elem : iterable) {
} |
| fori |
for (int i = 0; i < SCRAMBLED_WORD_LIST.length; i++) {
} |
| fy |
finally |
| ie |
interface |
| ifelse |
if (condition) {
} else {
} |
| im |
implements |
| iof |
instanceof |
| ir |
import |
| le |
length |
| newo |
Object name = new Object(args); |
| pe |
protected |
| pr |
private |
| psf |
private static final |
| psfb |
private static final boolean |
| psfi |
private static final int |
| psfs |
private static final String |
| pst |
printStackTrace(); |
| psvm |
public static void main(String[] args) {
} |
| pu |
public |
| re |
return |
| serr |
System.err.println("|"); |
| sout |
System.out.println("|") |
| st |
static |
| sw |
switch ( |
| sy |
synchronized |
| tds |
Thread.dumpStack(); |
| th |
throws |
| trycatch |
try {
} catch (Exception e) {
} |
| tw |
throw |
| twn |
throw new |
| wh |
While ( |
| whilei |
while (it.hasNext()) {
Object elem = (Object) it.next();
} |
| Abbreviation |
Code Template |
| ag |
application.getAttribute("|") |
| ap |
application.putAttribute("|",) |
| ar |
application.removeAttribute("|") |
| cfgi |
config.getInitParameter("|") |
| jspf |
<jsp:forward page="|"/> |
| jspg |
<jsp:getProperty name="|" property="|"/> |
| jspi |
<jsp:include page="|"/> |
| jspp |
<jsp:plugin type="|" code="" codebase="">
</jsp:plugin> |
| jsps |
<jsp:setProperty name="|" property=""/> |
| jspu |
<jsp:useBean id="|" type=""/> |
| oup |
out.print("|") |
| oupl |
out.println("|") |
| pcg |
pageContext.getAttribute("|") |
| pcgn |
pageContext.getAttributeNamesInScope("|") |
| pcgs |
pageContext.getAttributesScope("|") |
| pcr |
pageContext.removeAttribute("|") |
| pcs |
pageContext.setAttribute("|",) |
| pg |
<%@page |%> |
| pga |
<%@ page autoFlush="false"%> |
| pgb |
<%@ page buffer="|kb"%> |
| pgc |
<%@page contentType="|"%> |
| pgerr |
<%@page errorPage="|"%> |
| pgex |
<%@page extends="|"%> |
| pgie |
<%@page isErrorPage="true"%> |
| pgim |
<%@page import="|"%> |
| pgin |
<%@page info="|"%> |
| pgit |
<%@page isThreadSafe="false"%> |
| pgl |
<%@page language="java"%> |
| pgs |
<%@page session="false"%> |
| rg |
request.getParameter("|") |
| sg |
session.getAttribute("|") |
| sp |
session.setAttribute("|", ) |
| sr |
session.removeAttribute("|") |
| tglb |
<%@taglib uri="|"%> |