简体   繁体   中英

IntelliJ - Can i cut & paste an entire class in?

Sometimes I want to paste an entire class in.

I don't really want to remember the class name - remembering is tricky!

In IntelliJ, it's easy to make a new java file - but then the class name has to match the name of the thing I'm pasting in!

IntelliJ is smart enough to, when I past code in, fix the package.

Can I somehow paste the code in so IntelliJ will also rename the file to match the public class file name?

After pasting your class, the class name should be underlined red.

You can put the cursor/caret on it and press Alt + Enter .

You'll get possible fixes: rename file or rename class.

Select the one to rename class.

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