Go Back   Wiki NewForum > Career Forum > Tech Forum & Tutorial > Java Forum & Tutorial

Sponsored Links

Java Forum & Tutorial JavaScript and Client-Side Browser Scripting

Reply
Views: 751  
Thread Tools Rate Thread Display Modes
  #1  
Old 05-25-2009, 04:51 PM
bholus7 bholus7 is offline
Banned
 
Join Date:
Apr 2009
Posts: 1,322
Default Keeping a Standard Coding Template

Keeping a Standard Coding Template


One old trick I had when learning to program was keeping a standard coding template. In it, I had a common list of import declarations so I would be covered for virtually all my needs. Then, use an IDE such as NetBeans, JBuilder, JCreator, or Eclipse that can autocomplete methods for you. For example, a beginner might want to copy and paste this template for basic console/command-line apps:

/*
* basic template
*/
import java.io.*;
import java.util.*;
// add more imports here when desired

public class BasicProgram {
public BasicProgram() {
}

public static void main(String[] args) {
BasicProgram program = new BasicProgram();
program.method1();
}

public void method1() {
System.out.println("Hello, Universe!");
}
}

Tip: The java.lang package is imported by default in all Java programs.

Reply With Quote
Reply

New topics in Java Forum & Tutorial

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump


Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2019, vBulletin Solutions, Inc.