欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Idea 中的一些常用快捷方式和扫描仪的两种用途

最编程 2024-03-31 13:55:05
...

常用Idea快捷键

  1. ctrl+shift+alt: 多行操作
  2. psvm: 生成main()方法
  3. fori: 生成for循环;
  4. ctrl+alt+v:自动补齐返回值类型
  5. ctrl+0:覆写方法
  6. ctrl+i:实现接口中的方法
  7. ctrl+shift+u:大小写转换
  8. ctrl+shift+z:取消撤销
  9. alt+insert:生成构造方法,getter,setter
  10. ctrl+y:删除当前行
  11. ctrl+shift+j:将选中的行合并成一行
  12. ctrl+g:定位到某一行
  13. ctrl+shift+上箭头:将光标所在代码块向上整体移动
  14. ctrl+shift+下箭头:将光标所在代码块向下整体移动
  15. alt+shift+向上箭头:将行向上移动
  16. alt+shift+向下箭头:将行向下移动
  17. ctrl+f:在当前文件中查找
  18. ctrl+r:替换字符串
  19. ctrl+shift+f:在全局文件中查找字符串
  20. ctrl+shift+r:在全局中替换字符串
  21. ctrl+shift+enter:自动补齐{}或者分号;
  22. shift+enter:在当前行的下方开始新行
  23. ctrl+alt+enter:在当前行的上方插入新行
  24. ctrl+delete:删除光

scanner

java Scanner 用法

Scanner a=new Scanner(System.in);
while(a.hasnext()){
    String s=a.hasnext();
    System.out.println(s);
}
/*遇到空格的话Scanner.next是无法读取空格后面的数据的*/


但Scanner.nextLine可以:

Scanner a=new Scanner(System.in);
while(a.hasnextLine()){
    String S=a.hasnextLine();
    System.out.println(S.nextLine());
}

推荐阅读