`
hubin4
  • 浏览: 96718 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

for java beginner 2 - eclipse code template and import static

    博客分类:
  • JAVA
阅读更多
java

1--

shortcut and template

syso --> System.out.println();

e.g.

right click | Surround with | Try/catch block
他是怎么知道这个东西是怎么写的呢?
有模版

现在 我弄一个try finally 怎么弄?

window | perferences | java | editor | templates

new |
name : tryf
pattern:
try{
//put cursor here and click Insert Variable select "line_selection"
//next line will show automatically
${line_selection}
}finally{
//put cursor here and click Insert Variable select "cursor"
//next line will show automatically
${cursor}
}

----
go back to edit view
select a line
right click
surround with
tryf

OK!!!

还有在 eclipse 里
package explore 视图窗口里的filters ,可以设置显示不显示空的父包(默认不显示).
2--导入project

最好是这样,先 workspace
再把project copy to workspace
eclipse 比较笨, 拷进去了他自己不肯识别
我们要 import 一下
general |
existing projects into workspace
还是file system
就自己分辨吧.看项目大小,发布情况等等...

进来后有可能 JDK 不一样,那自己把原来的干掉,添加自己电脑上的JDK
就是在 java build path | libraties tab下

★[库就是N个JAR,仅此而已]★
3--import
其实这个import没有什么说法,说浪费资源什么什么的,
仅仅就是为了在写source code 的时候少写些前缀罢了.
不推荐* ,为了可读性嘛...

有个小技巧,你要 syso 一些东西,可以先选择,再 alt + / 呵呵,会出现的
这个在土测试里经常会用到,打印一些乱七八糟的东西.
推荐LOGGER,system.out.println真的很拿不上台面...  


说了import,再说说JDK 1.5新特性,
import就是导入一些类,让你以后写这个类不要前缀了
1.5新有的 import static 这个是导入某个类的某个静态方法,
一.最最原始的: java.lang.Math.max(1,4);
二.有了import后,可以 Math.max(1,4); import java.lang.Math;
三,有了import static 直接 max(1,4); import static java.lang.Math.max;
当然,也可以一下子导入所有的静态方法,要记得变通,换个*不就是全部了嘛!
分享到:
评论

相关推荐

    Algorithm-Machine-Learning-for-Beginner-by-Python3.zip

    Algorithm-Machine-Learning-for-Beginner-by-Python3.zip,斯克莱恩、坦索流。,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。

    spring mvc beginner guider -source code

    "Spring MVC beginner guider - source code" 提供了一个适合初学者入门的教程,尽管名为“初学者指南”,但它的内容深度足以满足中级开发者的需求。 该教程可能涵盖以下关键知识点: 1. **Spring MVC架构**:...

    Manning - Eclipse In Action.pdf

    - **Coding**: Best practices for writing clean and maintainable code using Eclipse's features like code completion, refactoring, and debugging. - **Iteration**: The iterative nature of software ...

    Python库 | for-beginner-piano-0.3.1.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:for-beginner-piano-0.3.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    Cocos2d-X by Example Beginner's Guide-code

    《Cocos2d-X by Example Beginner's Guide-code》是一本专为初学者设计的Cocos2d-X游戏开发指南,其附带的代码文件旨在帮助读者深入理解和实践Cocos2d-X框架。Cocos2d-X是一个开源的游戏开发框架,基于C++,支持iOS...

    Java - A Beginner’s Guide - Sixth Edition - Herbert Schildt

    Additionally, it covers static imports and annotations, which are used for code simplification and metadata specification, respectively. ### Conclusion "Java - A Beginner’s Guide - Sixth Edition" ...

    Java - Java- A Beginner’s Guide - 7th edition

    ### Java - Java: A Beginner’s Guide - 7th Edition #### Java Fundamentals **起源与发展:** Java 语言起源于1990年代初期,在Sun Microsystems由James Gosling领导的一支团队开发。Java的设计目标是创造一种...

    Java and Algorithmic Thinking for the Complete Beginner – Compact Edition

    This book is for anyone who wants to learn computer programming and knows absolutely nothing about it. If you are wondering whether this book is going to teach you how to create amazing applets or ...

    java for the beginner

    introduce in english

    Java: A Beginner's Guide 5th Edition

    Fully updated to cover Java Platform, Standard Edition 7 (Java SE 7), Java: A Beginner's Guide, Fifth Edition starts with the basics, such as how to compile and run a Java program, and then discusses...

    For Dummies. Java All-in-One Desk Reference(《傻瓜系列:Java完全桌面参考手册》)

    in-one programming reference * Covers the recent release of the Java 2 Platform Standard Edition 5.0 and the new J2SE Development Kit 5.0 * Starts with beginner topics including getting started ...

    Python-Programming-for-the-Absolute-Beginner-3rd-Edition.zip

    Pygame是Python的一个扩展库,专为开发2D游戏和多媒体应用而设计。在本教程中,你将逐步了解Python编程的基础,同时通过构建实际的游戏项目来加深理解。 首先,你将学习如何安装Python和Pygame库。安装Python通常...

    Java-Programming-for-Beginner:书

    这本书《Java-Programming-for-Beginner》将引领你走进这个充满无限可能的世界。Java以其“一次编写,到处运行”的特性,使得开发者可以在多种平台上无缝地运行代码,极大地提高了开发效率。 1. **Java基础知识**:...

    COCOS2d-X by Example Beginner-'s Guide

    ### COCOS2d-X by Example Beginner's Guide #### 概述 《COCOS2d-X by Example Beginner's Guide》是一本专为初学者设计的Cocos2d-x游戏开发指南。本书由Roger Engelbert编写,旨在通过一系列实用的例子帮助读者...

    common-sense-c-advice-and-warnings-for-c-and-c-programmers.9781882419005.32087

    ### Common Sense C: Advice and Warnings for C and C++ Programmers #### Introduction "Common Sense C: Advice and Warnings for C and C++ Programmers" is a comprehensive guide aimed at helping ...

    Java Programming 24-Hour Trainer(Wrox,2ed,2015)

    Java Programming 24-Hour Trainer, 2nd Edition is your complete beginner's guide to the Java programming language, with easy-to-follow lessons and supplemental exercises that help you get up and ...

    godot-beginner-2d-platformer-1.1.0_game_godot_

    在"godot-beginner-2d-platformer-1.1.0_game_godot_"这个项目中,我们将深入探讨如何利用Godot Engine来构建一个基础的2D平台游戏。 首先,让我们了解2D平台游戏的基本元素。平台游戏是游戏中的一种类型,玩家控制...

    Java A Beginner's Guide(6th) 无水印pdf

    Java A Beginner's Guide(6th) 英文无水印pdf 第6版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...

Global site tag (gtag.js) - Google Analytics