- 浏览: 326808 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (224)
- Java (34)
- Test (3)
- Linux/Unix (32)
- Windows (8)
- Oracle (78)
- Oracle Backup & Recovery (3)
- SqlServer (1)
- Database (3)
- Open Source (2)
- Server Management (1)
- Apache ActiveMQ (1)
- IBM WebSphere MQ (7)
- IBM WAS (15)
- 其它 (11)
- UML (1)
- Tools (1)
- Reference (0)
- Spring (11)
- Hibernate (5)
- VBScript (3)
- Network (1)
- Securities (2)
- Maven (6)
- logging (2)
- Web (1)
- AWS (3)
最新评论
1. Array
int [] z [] [] = {{{1,2,3},{2,3}},{{3,4},{}}}; int [] z [] []; = int z [] [] []; int [][] a1 = {{},{}}; int [] a2 = a1[0]; // Correct int [] a3 = (int []) a1; // Error, cannot cast from int[][] to int[]
2. Implement interface
interface Base { boolean m1 (); byte m2(short s); } class Class2 implements Base { boolean m1( ) { return false; } byte m2(short s) { return 42; } } // class2 has compile error, as need specify public for both method. as interface methods are implicitly public.
3. Class.forName("")
Class c = Class.forName("TestB"); //错误,必须加上Package path, 尽管在同一package下. Class c = Class.forName("com.nan.tml.TestB"); //正确
4. 构造函数
class Top { public Top(String s) { System.out.print("B"); } } class Bottom2 extends Top { public Bottom2(String s) { super("s"); //如果没有这句,会报错,因为他会自动调用supper(); 黙认会有一个无参数构造函数, 如果定义了其它的构造函数,刚不会再有无参数构造函数,如需要,需再定义. System.out.print("D"); } public static void main(String[] args) { new Bottom2("C"); System.out.println(" "); } }
5. Argument
public class Test { public static void main(String[] args) { Arg arg = new Arg(); testArg(arg); // Reference argument System.out.println(arg.v1); //Will print 2. } static void testArg(Arg a) { a.v1 = 2; System.out.println(a.v1); // Will print 2. a = null; //Just specify the reference of argument a is null. } } class Arg { int v1 = 1; }
6. Type cast
double > long > int > short // Correct short s = 1; int i = s; long l = i; double d =l; // Wrong double d = 1; long l = d; int i = l; short s = i;
class Eggs { int doX(Long x, Long y) { return 1; } int doX(long... x) { return 2; } int doX(Integer x, Integer y) { return 3; } int doX(Number n, Number m) { return 4; } void go() { short s = 7; System.out.print(doX(s, s) + " "); // print 4 double d = 7; System.out.print(doX(d, d) + " "); // print 4 int i = 7; System.out.print(doX(i, i) + " "); // print 3 long l = 7; System.out.print(doX(l, l) + " "); // print 1 } public static void main(String[] args) { new Eggs().go(); } }
7. Overload
public class Test { public static void main(String[] args) { System.out.println(new Alien().invade((short) 7)); // Print a few System.out.println(new Alien().invade((short) 7, (short)7)); // Print many System.out.println(new Alien().invade((short) 7, (short) 7, (short) 7)); // Print many } } class Alien { String invade(short ships) { return "a few"; } String invade(short... ships) { return "many"; } }
8. Initialization
class Bird { { System.out.print("bl "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static { System.out.print("r1 "); } public Raptor() { System.out.print("r2 "); } { System.out.print("r3 "); } static { System.out.print("r4 "); } } public class Hawk extends Raptor { public static void main(String[] args) { System.out.print("pre "); new Hawk(); System.out.println("hawk "); } } // Will print: // r1 r4 pre bl b2 r3 r2 hawk
9. Serializable
class Player{ Player() { System.out.print("p"); } } public class Test extends Player implements Serializable { Test() { System.out.print("c"); } private Player player = new Player(); // will throw exception when run, as Player doesn't implements Serializable public static void main(String[] args){ Test c1 = new Test(); try { FileOutputStream fos = new FileOutputStream("play.txt"); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeObject(c1); os.close() ; FileInputStream fis = new FileInputStream("play.txt"); ObjectInputStream is = new ObjectInputStream(fis); is.readObject(); is.close(); } catch (Exception x ) { } } } // Will print pcp // It's okay for a class to implement Serializable even if its superelass doesn't. // However, when you deserialize such an object, the non-serializable superelass // must run its constructor. Remember, constructors don't run on deserialized // classes that implement Serializable.
发表评论
-
Set proxy with account/password for CloseableHttpClient
2018-07-04 22:32 561package com.hsbc.wealth.srbp; ... -
HTTPS setup & keyManagers trustManagers
2017-08-03 01:24 521https://jingyan.baidu.com/arti ... -
Base64Encoder & Base64Decoder
2017-03-16 23:29 690import java.io.UnsupportedEnco ... -
Spring transaction manager example
2015-09-19 14:25 630ApplicationContext.xml < ... -
java.lang.ClassCastException: $Proxy8 incompatible with lin.dao.impl.ExchangeDao
2015-09-19 14:01 1211Spring transaction practice, ... -
Eclipse: Resolve Workspace projects
2015-09-01 22:21 1667When Import Maven project: & ... -
Junit4 Sample
2014-11-13 00:15 673package com.lin.MavenTest; ... -
Junit3 Sample
2014-11-12 23:22 683package com.lin.MavenTest; ... -
《Spring In action》学习笔记——AOP(面向切面编程)
2014-10-25 11:09 9071.AOP术语 通知(Advice): 切面的功能被称 ... -
Suspend validation
2014-10-20 20:46 885Build workspace 的时候,出现如下错误。 ... -
Spring head
2014-09-04 18:28 595<?xml version="1.0&quo ... -
Joda-Time
2014-09-04 16:59 767http://www.joda.org/joda-time/ ... -
J2EE的13种核心技术规范
2014-07-02 10:44 676J2EE主要用于创建可扩展的企业应用,包括13种核心技术规范 ... -
Quartz任务调度快速入门
2014-06-26 14:41 585概述 了解Quartz体系结构 Quart ... -
Spring 笔记
2014-06-25 20:43 5141. BeanFactory BeanFactor ... -
SpringBatch的领域概念
2014-06-25 11:58 1519谈到Spring Batch,会谈到很多的领域概念,Job ... -
EJB2.0 ejb-jar.xml配置文件详解
2014-05-07 18:24 1378<ejb-jar><!--EJB发布描述器 ... -
开发EJB
2014-05-07 16:30 586现在,从如下几个方 ... -
Connect to Oracle DB - Java
2014-04-04 15:14 711import java.sql.*; public ... -
JVM系列
2013-12-05 21:01 800java内存组成介绍:堆( ...
相关推荐
SCJP典型试题1000例 SCJP典型试题1000例 SCJP典型试题1000例
### SCJP学习指南知识点概述 #### 一、声明与访问控制 (Declarations and Access Control) 本书的第一章重点讲解了声明和访问控制的概念及其在Java中的应用。这些概念对于理解和掌握面向对象编程至关重要。 #####...
SCJP – Sun Certified Java Programmer (Sun Java 程序员认证).Sun 公司作为Java 语言的发明者,对全球的Java 开发人员进行技术水平认证。该认证在国际上获得了IT 公司的普遍认可,是目前国际上最热门的IT 认证之一...
《SCJP大全》是一款全面覆盖SCJP(Sun Certified Programmer for Java Platform, Standard Edition)考试的知识资源,旨在帮助学习者一次性通过这项重要的Java编程认证。SCJP是Java开发人员的基础认证,证明了持有者...
SCJP,全称为Sun Certified Programmer for the Java 2 Platform,是Oracle公司(原Sun Microsystems)推出的针对Java程序员的认证考试。这个考试旨在测试考生对于Java SE平台基础编程的知识和技能。以下是一些SCJP...
SCJP 可以说各种Java认证的基础,相对于SCJD来说,SCJP更侧重于测验您的Java程序设计概念及能力,内容偏重于Java语法及JDK的内容。其对应的最主要的学习课程是SL-275。SCJP 的学习/考试过程是相对相对比较明确的,...
SCJP sun certificated java programmer (SCJP) 一种Java认证考试 对于Java程序设计员,Sun推出两项认证:Sun Certificated Java Programmer (SCJP)和Sun Certificated Java Developer(SCJD)。 SCJP 可以说...
SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)是Oracle公司为Java程序员提供的一项权威认证,证明其在Java编程语言上的专业能力。这个认证涵盖了基础语法、类库、异常处理、多线程、...
SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)是Oracle公司先前对Java程序员进行认证的一项考试,旨在测试开发者对于Java SE平台的基础知识和编程能力。这个压缩包文件包含了一个...
标题所指的“scjp题库(中文版)”是一本针对Java程序员职业认证——SCJP(Sun Certified Java Programmer)考试的中文版题库。SCJP是Oracle公司早期提供的Java认证考试,后由于Oracle收购了Sun公司,该认证也随之...
SCJP(Sun Certified Programmer for the Java Platform)是Oracle公司(原SUN公司)推出的一门针对Java编程语言的初级认证考试。这个认证旨在验证开发者对Java语言基础的掌握程度,包括语法、数据类型、控制结构、...
SCJP(Sun Certified Programmer for the Java Platform, Standard Edition)是Oracle公司(原Sun Microsystems)推出的一项Java编程语言的认证考试,旨在验证候选者对Java SE平台的基础知识和编程能力。这个认证...
SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)是Oracle公司先前为Java程序员提供的一个认证考试,旨在验证候选者对Java编程语言的基本理解与应用能力。这个"scjp模拟器"可能是用于...
Java SCJP,全称为Sun Certified Programmer for the Java 2 Platform, Standard Edition,是Oracle公司针对Java初学者和专业开发者的一项认证考试。这个“Java SCJP中文学习指南”旨在帮助中文使用者深入理解Java...
《SCJP官方教材中文版》是一本专门为准备SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)考试的学员编写的指南。SCJP,现已被Oracle认证为Oracle Certified Associate, Java SE 8 ...
SCJP,全称为Sun Certified Programmer for the Java 2 Platform, Standard Edition,是Oracle公司(原Sun Microsystems)为Java程序员提供的一项认证考试。这个题库包含了近1000道题目,旨在帮助考生全面掌握Java ...
SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)是Oracle公司为Java程序员提供的一项认证考试,旨在验证考生对Java编程语言的基础知识和理解。这个“SCJP考试模拟软件”显然是一款帮助...
资源名称:[浪曦原创]SCJP试题解析视频课程(胡屹)资源目录:【】[A309]SCJP视频解析—序列化【】[A310]SCJP视频解析—字符串上【】[A311]SCJP视频解析—字符串下【】[A312]SCJP试题解析—Constructors【】[A318]SCJP...