Copy and paste code into Eclipse

There is a cool feature in Eclipse: You can paste code you copied from antoher website into a source folder of Eclipse and all needed resources will be created:

  • Package structure
  • Class/Interface/Enum
  • Code will be pasted into the newly created file

For instance you’ll find this code anywhere in a tutorial:
package a.b.c;
class A{
    public A(){}

    public void methodA(){
      System.out.println("This is a very useful class!");
Copy this code and paste it into an Eclipse source folder. After this a new package structure a/b/c and a new class with the content exists.
That’s all. A very useful feature…

Comments are closed.