简体   繁体   中英

Creating custom class code in eclipse

I code java in eclipse, and i am spending time every new problem i write the same starting code. So i wanted to create this as my custom class code:

import java.util.*;

public class CLASSNAME {

public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);

}

}

So i set my Preferences-Code templets-class body to that, but when i create a class i get this:

public class CLASSNAME {
import java.util.*;

public class CLASSNAME {

public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);

}

}}

How do i stop that from happening?

Have you tried putting import java.util.*; in "New Java files" instead of "Class body"?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM