FAQ(JAVA基础一)-整理

position-related consumption of civil servants has been swept by finance, consumer, regardless of cost, extravagance and waste in the civil service position-related consumption, abuse, corruption and embezzlement, corruption is important. Then, under the conditions of market economy, how to reform the existing civil duty consumption management, explores a source to prevent and curb the post consumption corruption way, is currently a major issue faced by honest work. Recently, I conducted research on this issue, this problem on some humble opinions. First, the existing public servants ' duty consumption the main problems seen from the investigation and reasons, in recent years, public servants ' duty consumption caused by the abuses and not a person of integrity, is one of the major problems in the party in Government, its operation order have a negative effect on the party and Government organs, seriously damaging the image of the party and the Government, underminingthe relationship between party and the masses, effect, opening up and economic construction. From I County in recent years of governance situation see, positions consumption in the produced of \nomenon rendering four a features: a is positions consumption system lost has due of binding, right is greater than rules, and right is greater than method of phenomenon more highlight; II is in positions consumption in the Camera Obscura operation, using terms, will positions consumption into has personal consumption, will corporate points to into personal points to, makes positions consumption in some aspects has into positions enjoy and self-dealing of means; three is to positions consumption for name, fraud, false impersonator, Trend of negative corruption phenomena such as corruption and misappropriation; four palaces, follow the fashion, rivalries, wasteful, and post consumption became a symbol of showing off their individual capacities. Caused by public servants ' dutyconsumption of many \nomenon in which people reflect the biggest problems are: (a) the official car problems. Mainly in three aspects: one is the larger buses cost expenditure. According to statistics, until November 2003, XX County township Department bus 159 cars, which department owns the bus 145 vehicles, and showed an increasing trend. Financial expenses cost per bus per year to 35,000 yuan, and in fact every cost up to 50,000 yuan. Some units also hiring temporary drivers and expenditure on wages and subsidies. Necessary to \car\so \pendants\ading to larger expenses. Second, gongchesiyong breed unhealthy tendencies. Some people believe that now some bus drivers use one-third, one-third leading private one-third used for official purposes. Some public servants, especially leading officials motoring, cars for private purposes, violating the self-discipline regulations, and even lead to traffic accidents. According to statistics from related departments, since 2004, the correct investigation in our County serves nearly 30 cars for private purposes, only the first half of this year, cars for private purposes or类型:JAVA基础

1. Collection 和 Collections的区别

答案: (1)Collection是集合类的上级接口,继承与他的接口主要有Set 和List.

(2)Collections是针对集合类的一个帮助类,他提供一系列静态方法实现对各种集合的搜索、排序、线程安全化等操作

2. Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,

是否可以implements(实现)interface(接口)

答案: (1)匿名的内部类是没有名字的内部类。不能extends(继承) 其它类, (2)但一个内部类可以作为一个接口,由另一个内部类实现 3. char型变量中能不能存贮一个中文汉字?为什么?

答案: 能够定义成为一个中文,因为java中以unicode编码,一个char占16个字节 4. JAVA类实现序例化

答案: 实现java.io.Serializable接口

序列化是为了解决在对对象流进行读写操作时所引发的问题。 5. STRING与STRINGBUFFER的区别。

答案: STRING的长度是不可变的(final class),STRINGBUFFER的长度是可变的 6. 谈谈final, finally, finalize的区别

答案:final 修饰类:不能派生出子类,不能作为父类被继承。 final 修饰变量:该变量不可改变。 final 声明方法:只能使用,不能重载

finally:异常处理时如果有finally语句,就肯定执行。

finalize:finalize() 方法是在垃圾收集器删除对象之前对这个对象调用的 7. error和exception有什么区别

答案: (1) error 表示恢复不是不可能但很困难的情况下的一种严重问题。比如说内存溢出。不可能指望程序能处理这样的情况

(2)exception 表示一种设计或实现问题。也就是说,它表示如果程序运行正常,从不会发生的情况

8. 是否可以继承String类

答案: String类是final类故不可以继承

9. try {}里有一个return语句,那么紧跟在这个try后的finally {}里的code会不会被执行,

什么时候被执行,在return前还是后 答案: 会执行,在return前执行

10. 两个对象值相同(x.equals(y) == true),但却可有不同的hash code,

这句话对不对

答案: 不对,有相同的hash code

11. swtich是否能作用在byte上,是否能作用在long上,是否能作用在String上

答案: 传递给switch和case语句的参数应该是int、short、char或者byte。long,string都不能作用于swtich

12. abstract的method是否可同时是static,是否可同时是native,是否可同时是synchronized

答案: 都不能

13. java内存管理机制(垃圾回收机制)

答案: (1)垃圾回收是一种动态存储管理技术,它自动地释放不再被程序引用的对象,当一个对象不再被引用的时候,按照特定的垃圾收集算法来实现资源自动回收的功能。 (2) System.gc();就是呼叫java虚拟机的垃圾回收器运行 回收内存的垃圾

eaders driving a vehicle accident caused by road accidents, 1, 1 people killed and direct economic losses amounting to more than 100,000 yuan. Third, high efficiency and low cost of the bus. Surveys show that, the operating costs of taxis for the 8200/... Is a fundamental priority of the reform, it is a difficult problem that must be solved in the reform process. Clearly, the post consumption averages three years before as a base and fine-tuned on the basis of this single practices must be improved. Improvements to adhere to three principles: first, under the existing policy provisions approved for public servants ' duty consumption standards, calibration, is not contrary to policy. Second, according to the local financial situation and people's sustainability, public servants ' duty consumption standards approved, both financial reach, and people passing through. Third, according to the operational needs of civil servants responsible for authorized public servants ' duty consumption standards, both high and low positions, but also the nature of the work and the workload. In reform of method Shang, approved civil servants positions consumption standard to \nd small dispersed\ble, that most positions consumption project should according to policy provdes proposed unified standard, consider to ranks, and units and the work task of differences sex, unified of standard should has elastic of and dynamic of, makes regions, and units in implementation unified standard Shi has must of flexible disposal right; but since set of standard must after financial, and audit, sector audit approved Hou to implementation. (C) reform package. Public servants ' duty consumption elasticity of consumption to limit consumption, turning mess into kitchen after dinner, follow the civil servant with a how to use personal title subsidies, or how to manage a personal duty consumption use of subsidies. herefore, we must establish and perfect with public servants ' duty consumption monetization reform support of the series of governance systems such as the civil service examination of responsibility, system, low fault investigation system, the report said. While other measures to keep up. Discipline inspection and supervision organs, financial, auditing departments should strengthen supervision and inspection of public servants ' duty consumption monetization reform progress, to strengthen the reform of public servants ' duty consumption monetization system, measures to develop and monitor the implementation of inspection, not consumption as required, even shifting consumer behavior to stop, serious cases to deal with. Three ideas, public servants ' duty consumption monetization reform of politics, the economy and the deepening of the reform, public servants ' duty consumption as somewhere between a reform also demonstrated its importance and urgency. First of all, civil servants especially party and Government leaders and public servants ' dutyconsumption there are big drawbacks. NPC deputies and CPPCC members and the broad masses are concerned about. Secondly, theposition-related consumption of civil servants has been swept by finance, consumer, regardless of cost, extravagance and waste in the civil service position-related consumption, abuse, corruption and embezzlement, corruption is important. Then, under the conditions of market economy, how to reform the existing civil duty consumption management, explores a source to prevent and curb the post consumption corruption way, is currently a major issue faced by honest work. Recently, I conducted research on this issue, this problem on some humble opinions. First, the existing public servants ' duty consumption the main problems seen from the investigation and reasons, in recent years, public servants ' duty consumption caused by the abuses and not a person of integrity, is one of the major problems in the party in Government, its operation order have a negative effect on the party and Government organs, seriously damaging the image of the party and the Government, underminingthe relationship between party and the masses, effect, opening up and economic construction. From I County in recent years of governance situation see, positions consumption in the produced of \nomenon rendering four a features: a is positions consumption system lost has due of binding, right is greater than rules, and right is greater than method of phenomenon more highlight; II is in positions consumption in the Camera Obscura operation, using terms, will positions consumption into has personal consumption, will corporate points to into personal points to, makes positions consumption in some aspects has into positions enjoy and self-dealing of means; three is to positions consumption for name, fraud, false impersonator, Trend of negative corruption phenomena such as corruption and misappropriation; four palaces, follow the fashion, rivalries, wasteful, and post consumption became a symbol of showing off their individual capacities. Caused by public servants ' dutyconsumption of many \nomenon in which people reflect the biggest problems are: (a) the official car problems. Mainly in three aspects: one is the larger buses cost expenditure. According to statistics, until November 2003, XX County township Department bus 159 cars, which department owns the bus 145 vehicles, and showed an increasing trend. Financial expenses cost per bus per year to 35,000 yuan, and in fact every cost up to 50,000 yuan. Some units also hiring temporary drivers and expenditure on wages and subsidies. Necessary to \car\so \pendants\ading to larger expenses. Second, gongchesiyong breed unhealthy tendencies. Some people believe that now some bus drivers use one-third, one-third leading private one-third used for official purposes. Some public servants, especially leading officials motoring, cars for private purposes, violating the self-discipline regulations, and even lead to traffic accidents. According to statistics from related departments, since 2004, the correct investigation in our County serves nearly 30 cars for private purposes, only the first half of this year, cars for private purposes or14. abstract class和interface有什么区别

答案:

(1) 抽象类: 声明方法的存在而不去实现它的类被叫做抽象类.

不能创建abstract 类的实例. 不能有抽象构造函数或抽象静态方法

Abstract 类的子类为它们父类中的所有抽象方法提供实现,否则它们也是抽象类为

(2)接口:接口(interface)是抽象类的变体。在接口中,所有方法都是抽象的

接口可以实现多继承。

接口只可以定义static final成员变量 实现接口的类必须实现所有接口里声明的方法。

15. Static

答案:

(1)静态方法:可以通过类名来直接调用(也可以通过对象的引用来调用,不建议)

不能访问非静态变量。不能被非静态方法重写

(2)静态变量:表示类的所有对象共享该变量(即内存中只有一个该变量) 非静态变量:类的每个对象都有一个该变量,且彼此互不影响。

(3)静态初始化块:当类的对象生成时,静态初始化块运行一次,且只能运行一次。 静态初始化块在构造方法之前运行。

16. Java异常

答案:

Error:不能做任何处理

Exception:我们可以进行一些处理,

Exception:1 RuntimeException(unchecked exception)运行时异常(未检查异常) 2.Checked exception(检查的异常) 对于Checked exception有两种解决方案 (1)用try…catch捕获

(2)在调用这个会抛出异常的方法声明中,继续throws 这个异常(也就是继续向外抛) 17. ArrayList,Vector,LinkedList三者的存储特性,与性能。

答案: LinkedList类

LinkedList实现了List接口,允许null元素。

此外LinkedList提供额外的get,remove,insert方法在LinkedList的首部或尾部。 LinkedList不是同步的(不是线程安全)。

实现线程安全:List list = Collections.synchronizedList(new LinkedList(...)); 增删快,查询慢。 ArrayList类

ArrayList实现了可变大小的数组。它允许null。

ArrayList没有同步。 增删慢,查询块。 Vector类

ArrayList线程安全。 效率低 18. HashMap和Hashtable的区别

答案: (1)同步性:Hashtable是线程安全的,也就是说是同步的,效率高,而HashMap是线程序不安全的,不是同步的,效率相对低。

(2)值:只有HashMap可以让你将空值作为一个表的条目的key或value

eaders driving a vehicle accident caused by road accidents, 1, 1 people killed and direct economic losses amounting to more than 100,000 yuan. Third, high efficiency and low cost of the bus. Surveys show that, the operating costs of taxis for the 8200/... Is a fundamental priority of the reform, it is a difficult problem that must be solved in the reform process. Clearly, the post consumption averages three years before as a base and fine-tuned on the basis of this single practices must be improved. Improvements to adhere to three principles: first, under the existing policy provisions approved for public servants ' duty consumption standards, calibration, is not contrary to policy. Second, according to the local financial situation and people's sustainability, public servants ' duty consumption standards approved, both financial reach, and people passing through. Third, according to the operational needs of civil servants responsible for authorized public servants ' duty consumption standards, both high and low positions, but also the nature of the work and the workload. In reform of method Shang, approved civil servants positions consumption standard to \nd small dispersed\ble, that most positions consumption project should according to policy provides proposed unified standard, consider to ranks, and units and the work task of differences sex, unified of standard should has elastic of and dynamic of, makes regions, and units in implementation unified standard Shi has must of flexible disposal right; but since set of standard must after financial, and audit, sector audit approved Hou to implementation. (C) reform package. Public servants ' duty consumption elasticity of consumption to limit consumption, turning mess into kitchen after dinner, follow the civil servant with a how to use personal title subsidies, or how to manage a personal duty consumption use of subsidies. Therefore, we must establish and perfect with public servants ' duty consumption monetization reform support of the series of governance systems such as the civil service examination of responsibility, system, low fault investigation system, the report said. While other measures to keep up. Discipline inspection and supervision organs, financial, auditing departments should strengthen supervision and inspection of public servants ' duty consumption monetization reform progress, to strengthen the reform of public servants ' duty consumption monetization system, measures to develop and monitor the implementation of inspection, not consumption as required, even shifting consumer behavior to stop, serious cases to deal with. Three ideas, public servants ' duty consumption monetization reform of politics, the economy and the deepening of the reform, public servants ' duty consumption as somewhere between a reform also demonstrated its importance and urgency. First of all, civil servants especially party and Government leaders and public servants ' dutyconsumption there are big drawbacks. NPC deputies and CPPCC members and the broad masses are concerned about. Secondly, theposition-related consumption of civil servants has been swept by finance, consumer, regardless of cost, extravagance and waste in the civil service position-related consumption, abuse, corruption and embezzlement, corruption is important. Then, under the conditions of market economy, how to reform the existing civil duty consumption management, explores a source to prevent and curb the post consumption corruption way, is currently a major issue faced by honest work. Recently, I conducted research on this issue, this problem on some humble opinions. First, the existing public servants ' duty consumption the main problems seen from the investigation and reasons, in recent years, public servants ' duty consumption caused by the abuses and not a person of integrity, is one of the major problems in the party in Government, its operation order have a negative effect on the party and Government organs, seriously damaging the image of the party and the Government, underminingthe relationship between party and the masses, effect, opening up and economic construction. From I County in recent years of governance situation see, positions consumption in the produced of \nomenon rendering four a features: a is positions consumption system lost has due of binding, right is greater than rules, and right is greater than method of phenomenon more highlight; II is in positions consumption in the Camera Obscura operation, using terms, will positions consumption into has personal consumption, will corporate points to into personal points to, makes positions consumption in some aspects has into positions enjoy and self-dealing of means; three is to positions consumption for name, fraud, false impersonator, Trend of negative corruption phenomena such as corruption and misappropriation; four palaces, follow the fashion, rivalries, wasteful, and post consumption became a symbol of showing off their individual capacities. Caused by public servants ' dutyconsumption of many \nomenon in which people reflect the biggest problems are: (a) the official car problems. Mainly in three aspects: one is the larger buses cost expenditure. According to statistics, until November 2003, XX County township Department bus 159 cars, which department owns the bus 145 vehicles, and showed an increasing trend. Financial expenses cost per bus per year to 35,000 yuan, and in fact every cost up to 50,000 yuan. Some units also hiring temporary drivers and expenditure on wages and subsidies. Necessary to \car\so \pendants\ading to larger expenses. Second, gongchesiyong breed unhealthy tendencies. Some people believe that now some bus drivers use one-third, one-third leading private one-third used for official purposes. Some public servants, especially leading officials motoring, cars for private purposes, violating the self-discipline regulations, and even lead to traffic accidents. According to statistics from related departments, since 2004, the correct investigation in our County serves nearly 30 cars for private purposes, only the first half of this year, cars for private purposes or19. java中有几种类型的流?JDK为每种类型的流提供了一些抽象类以供继承,请说出他们分别是

哪些类?

答案: 字节流,字符流。字节流继承于InputStream OutputStream,字符流继承于

InputStreamReader OutputStreamWriter。在java.io包中还有许多其他的流,主要是为了提高性能和使用方便。 20. java中的JVM是否了解?

答案: Java虚拟机(JVM)是可运行Java代码的假想计算机。 因为有jvm所以可以实现java的跨平台。

eaders driving a vehicle accident caused by road accidents, 1, 1 people killed and direct economic losses amounting to more than 100,000 yuan. Third, high efficiency and low cost of the bus. Surveys show that, the operating costs of taxis for the 8200/... Is a fundamental priority of the reform, it is a difficult problem that must be solved in the reform process. Clearly, the post consumption averages three years before as a base and fine-tuned on the basis of this single practices must be improved. Improvements to adhere to three principles: first, under the existing policy provisions approved for public servants ' duty consumption standards, calibration, is not contrary to policy. Second, according to the local financial situation and people's sustainability, public servants ' duty consumption standards approved, both financial reach, and people passing through. Third, according to the operational needs of civil servants responsible for authorized public servants 'duty consumption standards, both high and low positions, but also the nature of the work and the workload. In reform of method Shang, approved civil servants positions consumption standard to \nd small dispersed\ble, that most positions consumption project should according to policy provides proposed unified standard, consider to ranks, and units and the work task of differences sex, unified of standard should has elastic of and dynamic of, makes regions, and units in implementation unified standard Shi has must of flexible disposal right; but since set of standard must after financial, and audit, sector audit approved Hou to implementation. (C) reform package. Public servants ' duty consumption elasticity of consumption to limit consumption, turning mess into kitchen after dinner, follow the civil servant with a how to use personal title subsidies, or how to manage a personal duty consumption use of subsidies. Therefore, we must establish and perfect with public servants ' duty consumption monetization reform support of the series of governance systems such as the civil service examination of responsibility, system, low fault investigation system, the report said. While other measures to keep up. Discipline inspection and supervision organs, financial, auditing departments should strengthen supervision and inspection of public servants ' duty consumption monetization reform progress, to strengthen the reform of public servants ' duty consumption monetization system, measures to develop and monitor the implementation of inspection, not consumption as required, even shifting consumer behavior to stop, serious cases to deal with. Three ideas, public servants ' duty consumption monetization reform of politics, the economy and the deepening of the reform, public servants ' duty consumption as somewhere between a reform also demonstrated its importance and urgency. First of all, civil servants especially party and Government leaders and public servants ' dutyconsumption there are big drawbacks. NPC deputies and CPPCC members and the broad masses are concerned about. Secondly, the

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4