




已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1. 12312. 12rrr1.1. 23124fff polycom 用java输入输出流复制一个图片文件。String file_in = “”;String file_out=”;RandomAccessFile rafIn = new RandomAccessFile(file_in,”r”); RandomAccessFile rafOut = new RandomAccessFile(file_out,”rw”);Byte b = new byte13;Int count = -1;While(count=rafIn.read(b)!=-1)rafOut.write(b,0,count);rafIn.close();rafOut.close(); intel 解释 try catch(Exception e) 的整个过程。 lenovo 看程序写结果:int a = 5; int b = 10; int c = a+b; 写出a, b, c。 Thomson Reuters 解释什么是内部类。 瞬联 应聘的是高级开发,collection和collections有啥区别? A:Collections是个java.util下的类,它包含有各种有关集合操作的静态方法。Collection是个java.util下的接口,它是各种集合结构的父接口。 新锐国际 垃圾回收的优点和原理。并考虑2种回收机制。 A:Java语言中一个显著的特点就是引入了垃圾回收机制,使c+程序员最头疼的内存管理的问题迎刃而解,它使得Java程序员在编写程序的时候不再需要考虑内存管理。由于有个垃圾回收机制,Java中的对象不再有“作用域”的概念,只有对象的引用才有“作用域”。垃圾回收可以有效的防止内存泄露,有效的使用可以使用的内存。垃圾回收器通常是作为一个单独的低级别的线程运行,不可预知的情况下对内存堆中已经死亡的或者长时间没有使用的对象进行清楚和回收,程序员不能实时的调用垃圾回收器对某个对象或所有对象进行垃圾回收。回收机制有分代复制垃圾回收和标记垃圾回收,增量垃圾回收。 极光互动 堆溢出与栈溢出危害的区别?(扩展:需要了解内存中什么是堆什么是栈) A:栈溢出是栈顶指针指向未知区域,可能造成系统崩溃,不仅仅指错数据而已。 tsingsoft Which of the following class definitions defines a legal abstract class? Select all right answers.A. class Animal abstract void growl(); B. abstract Animal abstract void growl();C. class abstract Animal abstract void growl();D. abstract class Animal abstract void growl(); E. abstract class Animal abstract void growl()System.out.println(growl); tsingsoft What is the proper way of defining a class named Key so that it cannot be subclassed?A class Key B abstract final class Key C native class Key D class Key final;E final class Key tsingsoft Given this class definitions: abstract class Transaction implements Runnable class Deposit extends Transaction protected void process() addAmount(); void undo(int i) System.out.println(Undo); private void addAmount() What will happen if we attempted to compile the code? Select the one right answer:A. This code will not compile because the parameter i is not used in undo().B. This code will not compile because there is no main()method. C. This code will not compile because Deposit must be an abstract class. D. This code will not compile because Deposit is not declared public. E. Everything will compile fine. tsingsoft Given the following code:class Tester public static void main(String args) CellPhone cell = new CellPhone();cell.emergency();class Phone final void dial911() / code to dial 911 here . . .class CellPhone extends Phone void emergency() dial911();What will happen when you try to compile and run the Tester class?A The code will not compile because Phone is not also declared as final.B The code will not compile because you cannot invoke a final method from a subclass.C The code will compile and run fine.D The code will compile but will throw a NoSuchMethodException when Tester is run.E Phone and CellPhone are fine, but Tester will not compile because it cannot create an instance of a class that derives from a class defining a final method. 新媒传信 Vector和ArrayList是否是线程安全的?A:Vector是线程安全的,ArrayList不是。 新媒传信 RecordStore对象在保存数据的时候跟普通的关系数据库有何区别(需要注意什么)? A:RecordStore的中的记录的RecordID是递增无重复的,即使一条记录被删除,它的RecordID也不能被重复使用。另外RecordStore需要显示地调用closeRecordStore方法来持久化更改过的数据。 新媒传信 请简述什么是“观察者模式”,它的意义是什么?可能的话举出JAVA类库中使用到这个模式的实例A:观察者模式又叫做发布-订阅(Publish/Subscribe)模式。观察者模式定义了一种一对多地依赖模式,让多个观察者同时监听某一个主题对象。这个主题对象在状态发生变化时,会通知所有的观察者对象,使它们能够自动更新自己。这里的主题对象就是指通知者,又叫做发布者。观察者又叫订阅者。在JDK中继承java.util.Observable类 可以实现观察者模式。 新媒传信 下面这段代码从继承关系以及方法重载的角度来看,它可以通过编译么?如果可以,main()方法运行以后,屏幕输出是什么?如果不可以,请说明原因。public class TestMain public static void main(Stringargs) Child c = new Child(); System.out.println(Father)c).getName(); abstract class Person public String m_name = God; public String getName() return m_name; class Father extends Person public String m_name = Father; public String getName() return super.m_name; class Child extends Father public String getName() return m_name; A:可以通过编译的,屏幕输出字符串 Father 新媒传信 a) 请说明synchronized关键字的作用以及使用范围。b) 请说明volatile关键字的作用以及使用范围。c) 请说明transient关键字的作用以及使用范围。A:a) synchronized 关键字是同步关键字,它包括两种用法:synchronized 方法和 synchronized 代码块。b) volatile修饰的成员变量在每次被线程访问时,都强迫从共享内存中重读该成员变量的值。而且,当成员变量发生变化时,强迫线程将变化值回写到共享内存。这样在任何时刻,两个不同的线程总是看到某个成员变量的同一个值。它只能用于修饰变量。c) transient 关键字表示在该对象被序列化(持久化)的时候不保存该属性。它只能用于修饰变量或者常量(即类属性)。 HUAWEI 第一部分QUESTION NO: 1 1、public class Test public static void changeStr(String str)str=welcome; public static void main(String args) String str=1234;changeStr(str);System.out.println(str);Please write the output result :QUESTION NO:21. public class Test 2. static boolean foo(char c) 3. System.out.print(c);4. return true;5. 6. public static void main( String argv ) 7. int i =0;8.for ( foo(A); foo(B)&(i2); foo(C)9.i+ ;10. foo(D);12. 13. 14. What is the result?A. ABDCBDCBB. ABCDABCDC. Compilation fails.D. An exception is thrown at runtime.QUESTION NO: 31. class A 2. protected int method1(int a, int b) return 0; 3. Which two are valid in a class that extends class A? (Choose two)A. public int method1(int a, int b) return 0; B. private int method1(int a, int b) return 0; C. private int method1(int a, long b) return 0; D. public short method1(int a, int b) return 0; E. static protected int method1(int a, int b) return 0; QUESTION NO: 41. public class Outer2.public void someOuterMethod() 3. / Line 34. 5. public class Inner6. public static void main( Stringargv ) 7. Outer o = new Outer();8. / Line 89. 10.Which instantiates an instance of Inner?A. new Inner(); / At line 3B. new Inner(); / At line 8C. new o.Inner(); / At line 8D. new Outer.Inner(); / At line 8/new Outer().new Inner()QUESTION NO: 5Which method is used by a servlet to place its session ID in a URL that is written to the servlets response output stream?A. The encodeURL method of the HttpServletRequest interface.B. The encodeURL method of the HttpServletResponse interface.C. The rewriteURL method of the HttpServletRequest interface.D. The rewriteURL method of the HttpServletResponse interface.QUESTION NO: 6Which of the following statements regarding the lifecycle of a session bean are correct?A. java.lang.IllegalStateException is thrown if SessionContext.getEJBObject() is invoked when a stateful session bean instance is passivated.B. SessionContext.getRollbackOnly() does not throw an exception when a session bean with bean-managed transaction demarcation is activated.C. An exception is not thrown when SessionContext.getUserTransaction() is called in the afterBegin method of a bean with container-managed transactions.D. JNDI access to java:comp/env is permitted in all the SessionSynchronization methods of a stateful session bean with container-managed transaction demarcation.E. Accessing resource managers in the SessionSynchronization.afterBegin method of a stateful session bean with bean-managed transaction does not throw an exception.QUESTION NO: 7 描述Struts体系结构?对应各个部分的开发工作主要包括哪些?QUESTION NO: 8 JSP有哪些内置对象和动作?它们的作用分别是什么? 阿里巴巴 什么是Web Service? A:Web Service就是为了使原来各孤立的站点之间的信息能够相互通信、共享而提出的一种接口。Web Service所使用的是Internet上统一、开放的标准,如HTTP、XML、SOAP(简单对象访问协议)、WSDL等,所以Web Service可以在任何支持这些标准的环境(Windows,Linux)中使用。注:SOAP协议(Simple Object Access Protocal,简单对象访问协议),它是一个用于分散和分布式环境下网络信息交换的基于XML的通讯协议。在此协议下,软件组件或应用程序能够通过标准的HTTP协议进行通讯。它的设计目标就是简单性和扩展性,这有助于大量异构程序和平台之间的互操作性,从而使存在的应用程序能够被广泛的用户访问。优势:1) 跨平台。2) SOAP协议是基于XML和HTTP这些业界的标准的,得到了所有的重要公司的支持。3) 由于使用了SOAP,数据是以ASCII文本的方式而非二进制传输,调试很方便;并且由于这样,它的数据容易通过防火墙,不需要防火墙为了程序而单独开一个“漏洞”。4) 此外,WebService实现的技术难度要比CORBA和DCOM小得多。5) 要实现B2B集成,EDI比较完善与比较复杂;而用WebService则可以低成本的实现,小公司也可以用上。6) 在C/S的程序中,WebService可以实现网页无整体刷新的与服务器打交道并取数。缺点:1) WebService使用了XML对数据封装,会造成大量的数据要在网络中传输。2) WebService规范没有规定任何与实现相关的细节,包括对象模型、编程语言,这一点,它不如CORBA。 阿里巴巴 写出下列代码的输出结果:public class TestTryCatch public static void main(String args) System.out.println(“i的值为。”+new TestTryCatch().test(); private int test() int i = 1; try return i; finally +i; System.out.println(“finally is Executed”); A: i的值为 1finally is Executed 阿里巴巴 l 如何取得年月日、小时分秒?l 如何取得从1970 年到现在的毫秒数?l 如何取得某个日期是当月的最后一天?l 如何格式化日期?【基础】A:1) 创建java.util.Calendar 实例(Calendar.getInstance(),调用其get()2) 方法传入不同的参数即可获得参数所对应的值,如:calendar.get(Calendar.YEAR);/获得年3) 以下方法均可获得该毫秒数: Calendar.getInstance().getTimeInMillis(); System.currentTimeMillis();4) 示例代码如下:Calendar time = Calendar.getInstance();time.set(Calendar.DAY_OF_MONTH,time.getActualMaximum(Calendar.DAY_OF_MONTH);利用java.text.DataFormat 类中的format()方法可将日期格式化。 阿里巴巴 java 和javasciprt 的区别。 A:JavaScript 与Java 是两个公司开发的不同的两个产品。Java 是SUN 公司推出的新一代面向对象的程序设计语言,特别适合于Internet 应用程序开发;而JavaScript 是Netscape 公司的产品,其目的是为了扩展Netscape Navigator功能,而开发的一种可以嵌入Web 页面中的基于对象和事件驱动的解释性语言,它的前身是Live Script;而Java 的前身是Oak 语言。下面对两种语言间的异同作如下比较:1) 基于对象和面向对象:Java 是一种真正的面向对象的语言,即使是开发简单的程序,必须设计对象;JavaScript 是种脚本语言,它可以用来制作与网络无关的,与用户交互作用的复杂软件。它是一种基于对象(Object Based)和事件驱动(Event Driver)的编程语言。因而它本身提供了非常丰富的内部对象供设计人员使用;2) 解释和编译:Java 的源代码在执行之前,必须经过编译;JavaScript 是一种解释性编程语言,其源代码不需经过编译,由浏览器解释执行;3) 强类型变量和类型弱变量:Java 采用强类型变量检查,即所有变量在编译之前必须作声明;JavaScript 中变量声明,采用其弱类型。即变量在使用前不需作声明,而是解释器在运行时检查其数据类型;4) 代码格式不一样。 阿里巴巴 介绍JAVA 中的Collection FrameWork(及如何写自己的数据结构) A:Collection FrameWork 如下:CollectionListLinkedListArrayListVector StackSetMapHashtableHashMapWeakHashMapCollection 是最基本的集合接口,一个Collection 代表一组Object,即Collection 的元素(Elements); Map 提供key 到value 的映射。 阿
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 25秋新人教版英语七年级上册 Starter Unit 1同步练习(含答案)
- 江苏语文自考试题及答案
- 2025年物业维修基金管理合同范本
- 2025年广西玉林市公需课培训(专业技术人员继续教育)试题及答案
- 商业伦理考试题库及答案
- 陕西定向选调考试真题及答案
- 番禺附中考试题目及答案
- 武胜县高考试卷真题及答案
- 软件开发员笔试题及答案
- 2025年婴幼儿照护赛竞赛试题附答案
- 社区十四五规划
- 《如何设计调查问卷》课件
- 幼儿园中班音乐《头发、肩膀、膝盖、脚》课件
- 高考英语专题复习-打破教材范围三本教材中的屠呦呦(配合人教版选择性必修一Unit-1话题)
- 液压与气压传动技术 课件 项目14 液压与气动系统的常见故障及案例分析
- 投标货物包装、运输方案
- 2024年广西公需科目参考答案
- 吉林房地产市场月报2024年08月
- 少儿美术课件国家宝藏系列《玉壶》
- GB/T 44670-2024殡仪馆职工安全防护通用要求
- 2024年孩子打架双方协商后协议书范文
评论
0/150
提交评论