Java 英文面试题
java经典面试题汇总
Java基础方面:1、作用域public,private,protected,以及不写时的区别答:区别如下:作用域当前类同一package 子孙类其他packagepublic √√√√protected √√√ ×friendly √√ × ×private √ × × ×不写时默认为friendly2、Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)答:匿名的内部类是没有名字的内部类。
不能extends(继承) 其它类,但一个内部类可以作为一个接口,由另一个内部类实现3、Static Nested Class 和 Inner Class的不同答:Nested Class (一般是C++的说法),Inner Class (一般是JA V A的说法)。
Java内部类与C++嵌套类最大的不同就在于是否有指向外部的引用上。
注:静态内部类(Inner Class)意味着1创建一个static内部类的对象,不需要一个外部类对象,2不能从一个static内部类的一个对象访问一个外部类对象4、&和&&的区别答:&是位运算符,表示按位与运算,&&是逻辑运算符,表示逻辑与(and)5、Collection 和 Collections的区别答:Collection是集合类的上级接口,继承与他的接口主要有Set 和List.Collections是针对集合类的一个帮助类,他提供一系列静态方法实现对各种集合的搜索、排序、线程安全化等操作6、什么时候用assert答:assertion(断言)在软件开发中是一种常用的调试方式,很多开发语言中都支持这种机制。
在实现中,assertion就是在程序中的一条语句,它对一个boolean表达式进行检查,一个正确程序必须保证这个boolean表达式的值为true;如果该值为false,说明程序已经处于不正确的状态下,系统将给出警告或退出。
经典java面试英文题
1.What is the result when you compile and run the following code?public class Test{public void method(){for(int i=0;i<3;i++){System.out.print(i);}System.out.print(i);}}result: compile error分析:i是局部变量。
for循环完成后,i的引用即消失。
2.What will be the result of executing the following code?Given that Test1 is a class.class Test1{public static void main(String[] args){Test1[] t1 = new Test1[10];Test1[][] t2 = new Test1[5][];if(t1[0]==null){t2[0] = new Test1[10];t2[1] = new Test1[10];t2[2] = new Test1[10];t2[3] = new Test1[10];t2[4] = new Test1[10];}System.out.println(t1[0]);System.out.println(t2[1][0]);}}result:null null分析:new数组后,数组有大小,但值为null3.What will happen when you attempt to compile and run the following code? class Base{int i = 99;public void amethod(){System.out.println("Base.method()");}Base(){amethod();}}public class Derived extends Base{int i = -1;public static void main(String args[]){Base b = new Derived();System.out.println(b.i);b.amethod();}public void amethod(){System.out.println("Derived.amethod()");}}result:Derived.amethod()99Derived.amethod()解释:Derived 重写了Base的amethod方法。
JAVA试题英文版(答案)
一.Which two demonstrate an “is a” relationship? (Choose Two)A. public interface Person { }//语法错了public class Employee extends Person { }B. public interface Shape { }//语法错了public class Employee extends Sha pe { }C. public interface Color { }//语法错了public class Employee extends Color { }D. public class Species { }public class Animal{private Species species;}E. interface Component { }Class Container implements Component (Private Component[ ] children;二.which statement is true?A. An anonymous inner class may be declared as finalB. An anonymous inner class can be declared as privateC. An anonymous inner class can implement mutiple interfacesD. An anonymous inner class can access final variables in any enclosing scope (不能)E. Construction of an instance of a static inner class requires an instance of the encloing outer class构造一个静态的内部类对象需要构造包含它的外部类的对象三. Given:1. package foo;2.3. public class Outer (4. public static class Inner (5. )6. )Which statement is true?A. An instance of the Inner class can be constructed with “new Outer.Inner ()”B. An instance of the inner class cannot be constructed outside of package foo他们都是public的,只要在外部import就行C. An instance of the inner class can only be constructed from within the outer classD. From within the package bar, an instance of the inner class can be constructed with “new inner()”四.Exhibit(展览、陈列):1 public class enclosinggone{2 public class insideone{}3 }4 public class inertest{5 public static void main (String[] args){6 enclosingone eo = new enclosingone();7 //insert code here8 }}Which statement at line 7 constructs an instance of the inner class?A. InsideOne ei = eo.new InsideOne(); 写程序试出来B. Eo.InsideOne ei = eo.new InsideOne();C InsideOne ei = EnclosingOne.new InsideOne();D.EnclosingOne InsideOne ei = eo.new InsideOne();五.1) interface Foo{2) int k=0;3) }4) public class Test implements Foo{5) public static void main(String args[]){6) int i;7) Test test =new Test();8) i=test.k;9) i=Test.k;10) i=Foo.k;11) }12) }What is the result?A. Compilation succeeds.B. An error at line 2 causes compilation to fail.C. An error at line 9 causes compilation to fail.D. An error at line 10 causes compilation to fail.E. An error at line 11 causes compilation to fail.六.//point Xpublic class Foo{public static void main(String[] args){PrintWriter out=new PrintWriter(new java.io.OutputStreamWriter(System.out),true); out.println("Hello");}}which statement at point X on line 1 allows this code to compile and run?在point X这个位置要填入什么代码才能使程序运行A.import java.io.PrintWriterB.include java.io.PrintWriterC.import java.io.OutputStreamWriterD.include java.io.OutputStreamWriterE.No statement is needed本来两个都要import,但是后者OutputStreamWriter指定了包结构java.io.OutputStreamWriter七.what is reserved words in java? 保留字而非关键字A. runB.defaultC. implementD. import八. which three are valid declaraction of a float?(float作为整数是可以的,其余几个都是double)A. float foo=-1;B. float foo=1.0;C. float foo=42e1;D. float foo=2.02f;E. float foo=3.03d;F. float foo=0x0123;九. Given:8. int index = 1;9. boolean[] test = new boolean[3]; (数组作为对象缺省初始化为false)10. boolean foo= test [index];What is the result?A. foo has the value of 0B. foo has the value of nullC. foo has the value of trueD. foo has the value of falseE. an exception is thrownF. the code will not compile十. Given:1. public class test(2. public static void main(String[]args){3. String foo = args [1];4. String foo = args [2];5. String foo = args [3];6. }7. }And the command line invocation:Java TestWhat is the result?A. baz has the value of “”B. baz has the value of nullC. baz has the value of “red”D. baz has the value of “blue”E. bax has the value of “green”F. the code does not compileG. the program throws an exception(此题题目出错了,重复定义了变量foo,如果没有重复的话,应选G,因为只传递了0-2三个数组元素,而题目中需要访问args [3],所以会抛出数组越界异常)十一.int index=1;int foo[]=new int[3];int bar=foo[index]; //bar=0int baz=bar+index; //baz=1what is the result?A. baz has a value of 0B. baz has value of 1C. baz has value of 2D. an exception is thrownE. the code will not compile十二.1)public class Foo{2)public static void main(String args[]){3)String s;4)System.out.println("s="+s);5)}6)}what is the result?A. The code compiles and “s=” is printed.B. The code compiles and “s=null” is printed.C. The code does not compile because string s is not initialized.D. The code does not compile because string s cannot be referenced.E. The code compiles, but a NullPointerException is thrown when toString is called.十三. Which will declare a method that forces a subclass to implement it?(谁声明了一个方法,子类必须实现它)A. public double methoda();B. static void methoda (double d1) {}C. public native double methoda();D. abstract public void methoda();E. protected void methoda (double d1){}十四.You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access modifier that will accomplish this objective?(你希望子类在任何包里都能访问父类,为完成这个目的,下列哪个是最严格的访问权限)A. PublicB. PrivateC. ProtectedD. TransientE. No access modifier is qualified十五. Given:1. abstract class abstrctIt {2. abstract float getFloat ();3. )4. public class AbstractTest extends AbstractIt {5. private float f1= 1.0f;6. private float getFloat () {return f1;}7. }What is the result?A. Compilation is successful.B. An error on line 6 causes a runtime failure.(抛出实时异常)C. An error at line 6 causes compilation to fail.D. An error at line 2 causes compilation to fail.(子类覆盖父类方法的时候,不能比父类方法具有更严格的访问权限)十六. Click the exhibit button:1. public class test{2. public int aMethod(){3. static int i=0;4. i++;5. return I;6. }7. public static void main (String args[]){8. test test = new test();9. test.aMethod();10. int j = test.aMethod();11. System.out.printIn(j);12. }13. }(局部变量不能声明为静态)What is the result?A. Compilation will fail.B. Compilation will succeed and the program will print “0”.C. Compilation will succeed and the program will print “1”.D. Compilation will succeed and the program will print “2”.十七.1) class Super{2) public float getNum(){return 3.0f;}3) }4)5) public class Sub extends Super{7) }which method, placed at line 6, will cause a compiler error?A. public float getNum(){return 4.0f;}B. public void getNum(){} 返回值类型不同不足以构成方法的重载C. public void getNum(double d){}D. public double getNum(float d){return 4.0d;}十八. Which declaration prevents creating a subclass of an outer class?A.static class FooBar{}B.pivate class Foobar{}C.abstract class FooBar{}D.final public class FooBar{}E.final abstract class FooBar{} 抽象类不能声明为final十九. byte[] array1,array2[]byte array3[][]byte[][] array4if each has been initialized, which statement will cause a compile error?A. array2 = array1;B. array2 = array3;C. array2 = array4;D. both A and BE. both A and CF. both B and C(一维数组和二维数组的区别)二十.class Super{public int i=0;public Super(String text){i=1;}public class Sub extends Super{public Sub(String text){i=2;}public static void main(String args[]){Sub sub=new Sub("Hello");System.out.println(sub.i);}}what is the result?A. compile will failB. compile success and print "0"C. compile success and print "1"D. compile success and print "2"子类总要去调用父类的构造函数,有两种调用方式,自动调用(无参构造函数),主动调用带参构造函数。
【推荐】干java的用英语咋介绍自己-优秀word范文 (12页)
本文部分内容来自网络整理,本司不为其真实性负责,如有异议或侵权请及时联系,本司将立即删除!== 本文为word格式,下载后可方便编辑和修改! ==干java的用英语咋介绍自己篇一:英文面试自我介绍英语面试指南Problem solver 解决问题能手 Creative thinker 充满创意Accurate 小心谨慎Team player 合群英文面试自我介绍Good morning, my name is Alan Turing, and my Chinese name is Tan Haihui; it is really a great honor to have this chance for the interview. I would like to answer whatever you may ask, and I hope I can make a good performance today.Now I will introduce myself briefly, I am 24 years old, and born in Sichuan province. I’m senior right now, studying in SichuanUniversity of Science & Engineering, my major is Computer Science & Technology, and I’ll get Bachelor Degree this year. Till Now, I’ve got almost 1 year working experience as a development engineer in Sichuan JiuYuanYinHai Company.I’m open-minded, have many interests like basketball, reading, travelling and especially in engineering such as software programing. That’s why I choose this kind of job as my career.Ok, that’s all. Thank you very much.如何用英语介绍自己的工作经验I: Please tell me your present job. (What’s your work experience)A: I am working in a software company as I mentioned before. My present job is Java programming, and I am looking for a new job which is morechallenging and better development.I: Have you done any successful cases in this field?Yes, I have worked in this field for almost 1 year. I’ll getBachelor Degree and graduate in Computer Science. And I used to workin a large, comp lex enterprise level applications. I’m really proficient in java programming and have a deep understanding in some database, such as oracle & mysql and I also know a little bit of SQL server. People person 与人相处融洽 Organized 组织力高I: What qualifications do you have that make you feel you will be successful in your field?First, I think my technical background is helpful. I have enough knowledge in Java programming. Secondly, I continue to learn thelatest knowledge of software development through the network. Finally, I have enough passion for my work. These qualifications will make me successful in my career.Top 10 Interview Questions1. Tell me about yourself / Please introduce yourself可以部分采用自我介绍2. What were your responsibilities in work / project? -I mainly focus on the programming, and also do some job in testing, submitting Bug and regression testing.3. What did you like or dislike about your previous job? -I enjoyed the people I worked with. It was a friendly and funatmosphere and I actually enjoyed going to work each morning. I felt the leadership team was great as well. They knew all of theiremployees on a first name basis and tried to make those personal connections. One of the reasons I am leaving is that I felt I was not challenged enough at the job.I feel my can be better utilized elsewhere, where my capabilities are more recognized and there is th(来自: : 干java的用英语咋介绍自己 )e opportunity for growth.4. What major challenges and problems did you face? How did youhandle them?你遇到过什么大的困难,并且是怎么解决的?(自己结合自己的情况用英语写出来背过)Well the first project I work with 5 other people as a group leader. The project is about a management system. I response for the backend programing, as a leader I can’t not …5. What is your greatest strength? –I can work well under pressure and I enjoy the wok that challenges me.6. What is your greatest weakness?缺点,如果面试的时候不提,就不要回答了。
java基础面试题(答案)
package com.tarena;
import java.util.Random;
public class TestArray {
final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h','i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
ቤተ መጻሕፍቲ ባይዱ答:B
3、已知表达式int m [ ] = {0,1,2,3,4,5,6};下面哪个表达式的值与数组下标量总数相等?
A)m.length()B)m.length C)m.length()+1D)m.length-1
答:D
4、已知如下代码:public class Test {long a[]=new long [10];public static void main(String arg[] ){ System.out.print(a[6]); } }请问哪个语句是正确的?
JAVA面试题及思考
JAVA⾯试题及思考===========================================学⽽时习之=============================================1.public class Test {public static void main(String[] args) {String str = "123";changeStr(str);System.out.print(str);}public static void changeStr(String str){str = "abc";}}关键词:java内存分配2.public class Test {static boolean foo(char c) {System.out.print(c);return true;}public static void main(String[] args) {int i = 0;for (foo('A'); foo('B') && (i < 2); foo('C')) {i++;foo('D');}}}关键词:c for3.public class B extends A {// here}class A {protected int method1(int a, int b) {return 0;}}//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; }关键词:override , overloadThe public type A must be defined in its own fileCannot reduce the visibility of the inherited method from AThe return type is incompatible with A.method1(int, int)This static method cannot hide the instance method from ADuplicate method method1(int, int) in type A⽅法重载是单个类内部,通常说⽅法调⽤ a. ⽅法名 b. 参数⽅法重写是继承关系中,全部相同,除了 a. ⼦可见度>=⽗可见度 b. ⼦final可终⽌继承4.public class Outer {public void someOuterMethod() {// Line 3}public class Inner {}public static void main(String[] args) {Outer o = new Outer();// Line 8}}// Which instantiates an instance of Inner?// A. new Inner(); // At line 3// B. new Inner(); // At line 8// C. new o.Inner(); // At line 8// D. new Outer.Inner(); // At line 8// E. new Outer().new Inner(); // At line 8关键词:内部类构造⽅法也是⽅法构造⽅法前必须有new 修饰谁调⽤⽅法:实例调⽤实例⽅法new,类调⽤类⽅法static还有⼀种内部类叫静态内部类5.CREATE TABLE zxg(a VARCHAR2(10),b VARCHAR2(10))INSERT INTO zxg VALUES('a',NULL);INSERT INTO zxg VALUES('b','234');INSERT INTO zxg(a,b) VALUES ('c','');INSERT INTO zxg(a,b) VALUES ('d','');SELECT*FROM zxg--1 a--2 b 234--3 c--4 dSELECT*FROM zxg WHERE b LIKE'%'--1 b 234--2 d关键词:LIKE , NULL关于oracle中like ‘%’ 或者 like '%%' 还有 is null ,is not null长度为零的字符串即空字符串varchar2 类型时为 null好⽐调⼀个⽅法的前提是调动者得存在6.//final 是形容词最终的,final 类不可以被继承,final 字段不可以被改变,final⽅法不可以被重写//The type A cannot subclass the final class B//Cannot override the final method from B//The final field A.s cannot be assigned//finally 是副词 try{}catch(){}finally{}//finalize() 是⽅法,垃圾回收机制关键词:final , finally , finalize7.Controlling Access to Members of a ClassAccess LevelsModifier Class Package Subclass Worldpublic Y Y Y Yprotected Y Y Y Nno modifier Y Y N NNprivate Y N N关于package的⼀个问题:package a;package a.b;有⽗⼦关系吗?在a中定义⼀个pckage-private 的类,该类能不能被a.b中的类访问?答案是:不能。
java面试题 英文
java面试题英文Java Interview QuestionsIntroduction:In recent years, Java has become one of the most popular programming languages worldwide. Its versatility and wide range of applications have made it a sought-after skill in the IT industry. As a result, job interviews often include a section dedicated to Java. In this article, we will explore some commonly asked Java interview questions and provide detailed explanations and solutions. Whether you are a seasoned developer or preparing for your first Java interview, this article will help you enhance your knowledge and boost your confidence.1. What is Java?Java is a high-level, object-oriented programming language developed by Sun Microsystems. It was designed to be platform-independent, which means Java programs can run on any operating system that has a Java Virtual Machine (JVM). Java consists of a compiler, runtime environment, and a vast library, making it a powerful tool for building a wide range of applications.2. Explain the difference between JDK, JRE, and JVM.JDK (Java Development Kit) is a software package that includes the necessary tools for developing, compiling, and running Java applications. It consists of the Java compiler, debugger, and other development tools.JRE (Java Runtime Environment) is a software package that contains the necessary components to run Java applications. It includes the JVM and a set of libraries required to execute Java programs.JVM (Java Virtual Machine) is a virtual machine that provides an execution environment for Java programs. It interprets the Java bytecode and translates it into machine code that can be executed by the underlying operating system.3. What is the difference between a class and an object?In object-oriented programming, a class is a blueprint or template for creating objects. It defines the properties and behaviors that an object will possess. An object, on the other hand, is an instance of a class. It represents a specific entity or concept and can interact with other objects.4. What are the features of Java?Java is known for its robustness, portability, and security. Some key features of Java include:- Object-oriented: Java follows the object-oriented programming paradigm, allowing developers to build modular and reusable code.- Platform-independent: Java programs can run on any platform that has a JVM, including Windows, Mac, and Linux.- Memory management: Java has automatic memory management through garbage collection, which helps in deallocating memory occupied by unused objects.- Exception handling: Java provides built-in mechanisms for handling exceptions, ensuring the smooth execution of programs.- Multi-threading: Java supports concurrent programming through multi-threading, allowing programs to perform multiple tasks simultaneously.5. Explain the concept of inheritance in Java.Inheritance is a fundamental concept in object-oriented programming, where a class inherits properties and behaviors from another class, known as the superclass or base class. The class that inherits these properties is called the subclass or derived class. In Java, inheritance allows code reuse, promotes modularity, and enables hierarchical classification of objects.There are several types of inheritance in Java, including single inheritance (where a class inherits from only one superclass) and multiple inheritance (where a class inherits from multiple superclasses using interfaces).6. What is the difference between method overloading and method overriding?Method overloading refers to the ability to have multiple methods with the same name but different parameters within a class. The methods can have different return types or different numbers and types of arguments. The compiler determines which method to call based on the arguments provided during the method call.Method overriding, on the other hand, occurs when a subclass provides a specific implementation for a method that is already defined in its superclass. The signature of the overridden method (name, return type, and parameters)must match exactly with that of the superclass. The overridden method in the subclass is called instead of the superclass's method when invoked.Conclusion:In this article, we have explored some common Java interview questions and provided detailed explanations and solutions. Understanding these concepts will not only help you ace your Java interview but also enhance your overall programming skills. Remember to practice coding and explore real-world scenarios to strengthen your understanding of Java. Good luck with your Java interviews!。
java面试题
java面试题大全-基础方面Java基础方面:1、作用域public,private,protected,以及不写时的区别答:区别如下:作用域 当前类 同一package 子孙类 其他packagepublic √ √ √ √protected √ √ √ ×friendly √ √ × ×private √ × × ×不写时默认为friendly2、Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interfac 答:匿名的内部类是没有名字的内部类。
不能extends(继承) 其它类,但一个内部类可以作为一个接口,由另一个3、Static Nested Class 和 Inner Class的不同答:Nested Class (一般是C++的说法),Inner Class (一般是JAVA的说法)。
Java内部类与C++嵌套类最大的不4、&和&&的区别答:&是位运算符,表示按位与运算,&&是逻辑运算符,表示逻辑与(and)5、Collection 和 Collections的区别答:Collection是集合类的上级接口,继承与他的接口主要有Set 和List.Collections是针对集合类的一个帮助类,他提供一系列静态方法实现对各种集合的搜索、排序、线程安全化等操6、什么时候用assert答:assertion(断言)在软件开发中是一种常用的调试方式,很多开发语言中都支持这种机制。
在实现中,assert 7、String s = new String("xyz");创建了几个String Object答:两个,一个字符对象,一个字符对象引用对象8、Math.round(11.5)等於多少? Math.round(-11.5)等於多少答: Math.round(11.5)==12;Math.round(-11.5)==-11;round方法返回与参数最接近的长整数,参数加1/2后求其9、short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错答:short s1 = 1; s1 = s1 + 1; (s1+1运算结果是int型,需要强制转换类型)short s1 = 1; s1 += 1;(可以10、Java有没有goto答:java中的保留字,现在没有在java中使用11、数组有没有length()这个方法? String有没有length()这个方法答:数组没有length()这个方法,有length的属性。
IBM英文面试题
ans:In abstract class some methods may contain definition,but in interface every method should be abstract
35.please draw mvc-2 architecture.
36.please draw that how design op module.
37.how to find a file on linux.
38.how to configure weblogic8.1 on linux.
ans: legacy is something that is old in terms of technology/ system
19.what is main difference hashmap and hastable
ans:Hash table is synchronised
52.what is use of dataflowdiagrams
53.wha t is ip in ur project.
54.what about reception module
———————————————————————————————————————————————————
11.how to u prove that abstrace class cannot instantiate directly.
ans:As they dont have constructor they cant be instantiated
java_swing面试题目(3篇)
第1篇一、Java Swing基本概念1. 什么是Java Swing?答:Java Swing是一种用于创建图形用户界面的库,它是Java语言的一个扩展,允许开发者创建具有丰富视觉效果的桌面应用程序。
2. Swing的组件有哪些?答:Swing组件包括基本组件(如按钮、标签、文本框等)、容器组件(如面板、窗口、滚动条等)、特殊组件(如树、表格等)。
3. Swing与AWT的区别是什么?答:Swing是基于Java的,而AWT是基于本地平台的。
Swing组件在不同平台上表现一致,而AWT组件在不同平台上可能有所不同。
Swing运行速度较慢,但提供了更多功能和更好的用户体验。
二、Swing基本组件1. 如何创建一个按钮,并设置其文本和字体?答:使用JButton类创建按钮,并设置其文本和字体。
```javaJButton button = new JButton("按钮");button.setFont(new Font("宋体", Font.PLAIN, 12));```2. 如何获取并设置文本框中的文本?答:使用JTextField类创建文本框,并通过getText()和setText()方法获取和设置文本。
```javaJTextField textField = new JTextField();String text = textField.getText(); // 获取文本textField.setText("新文本"); // 设置文本```3. 如何使用单选按钮(JRadioButton)实现多选?答:使用JRadioButton类创建单选按钮,并使用ButtonGroup类将它们分组。
```javaJRadioButton radioButton1 = new JRadioButton("选项1");JRadioButton radioButton2 = new JRadioButton("选项2");ButtonGroup buttonGroup = new ButtonGroup();buttonGroup.add(radioButton1);buttonGroup.add(radioButton2);```4. 如何使用复选框(JCheckBox)实现多选?答:使用JCheckBox类创建复选框,它们之间互不影响。
中软国际java面试题及参考答案
中软国际java面试题及参考答案面试题是中软国际java个人求职者在面试过程中的敲门砖,以下是店铺为大家收集到的中软国际java面试题及参考答案,希望对大家有帮助!中软国际java面试题及参考答案:填空题(1)Java语言具有许多优点和特点,下列选项中,哪个反映了Java 程序并行机制的特点?( B )A)安全性 B)多线性 C)跨平台 D)可移植(2)下列哪个类声明是正确的?( D )。
A)abstract final class HI{···}B)abstract private move(){···}C)protected private number; D)public abstract class Car{···}(3)下列关于for循环和while循环的说法中哪个是正确的?( D )。
A)while循环能实现的操作,for循环也都能实现B)while循环判断条件一般是程序结果,for循环判断条件一般是非程序结果C)两种循环任何时候都可替换D)两种循环结构中都必须有循环体,循环体不能为空(4)异常包含下列那些内容?( C )。
A)程序中的语法错误 B)程序的编译错误C)程序执行过程中遇到的事先没有预料到的情况D)程序事先定义好的可能出现的意外情况(5)Character流与Byte流的区别是 ( )。
A)每次读入的字节数不同 B)前者带有缓冲,后者没有C)前者是块读写,后者是字节读写D)二者没有区别,可以互换使用(6)监听事件和处理事件 ( )。
A)都由Listener完成 B)都由相应事件Listener处登记过的构件完成C)由Listener和构件分别完成 D)由Listener和窗口分别完成(7)Applet可以做下列那些操作? ( )。
A)读取客户端文件 B)在客户端主机上创建新文件C)在客户端装载程序库 D)读取客户端部分系统变量(8)下列哪个属于容器的构件? ( AD )。
恩士迅java面试英文题
恩士迅java面试英文题Enson Java Interview English Questions1. What is Java?Java is a high-level, object-oriented programming language developed by Sun Microsystems (now owned by Oracle) in 1995. It is known for its platform independence, which means that Java programs can run on any device or operating system that has a Java Virtual Machine (JVM). Java is widely used for creating web applications, mobile applications, desktop software, and enterprise solutions.2. What are the main features of Java?Java has several key features that make it popular among developers:- Object-oriented: Java follows the principles ofobject-oriented programming (OOP), allowing developers to create reusable and modular code.- Platform independence: Java's 'write once, run anywhere' approach allows programs to be run on any device with a JVM, making it highly portable.- Memory management: Java uses automatic garbage collection, freeing developers from managing memory manually. - Multi-threading: Java supports concurrent programmingwith its built-in support for threads, allowing multiple tasks to run simultaneously.- Security: Java provides a secure environment with its built-in security features, such as sandboxing and permission-based access control.3. What is the difference between JDK and JVM?JDK (Java Development Kit) and JVM (Java Virtual Machine) are both essential components of the Java platform, but they serve different purposes.- JDK: JDK is a software development kit that provides tools and libraries necessary for Java development. It includes the Java compiler, debugger, and other utilities required to write, compile, and run Java programs.- JVM: JVM is a runtime environment that executes Java bytecode. It interprets the compiled Java code and converts it into machine code that can be understood by the underlying operating system. JVM also handles memory management and provides various runtime services.4. What is the difference between an abstract class and an interface?- Abstract class: An abstract class is a class that cannot be instantiated and is typically used as a base class for otherclasses. It can contain both abstract and non-abstract methods. Subclasses of an abstract class must implement its abstract methods. An abstract class can also have fields and constructors.- Interface: An interface is a collection of abstract methods and constants. It cannot be instantiated and is used to define a contract for implementing classes. A class can implement multiple interfaces, but it can only extend a single class. Interfaces are used to achieve multiple inheritance in Java.5. What are the different types of exceptions in Java? Java has two types of exceptions: checked exceptions and unchecked exceptions.- Checked exceptions: These are exceptions that are checked at compile-time. The developer must either handle these exceptions using try-catch blocks or declare them in the method signature using the 'throws' keyword. Examples of checked exceptions include IOException and SQLException.- Unchecked exceptions: These are exceptions that are not checked at compile-time. They are subclasses of RuntimeException and Error classes. Unchecked exceptions do not need to be declared or caught explicitly. Examples ofunchecked exceptions include NullPointerException and ArrayIndexOutOfBoundsException.These are just a few sample questions that can be asked during a Java interview. It is important to remember that the depth and complexity of questions may vary depending on the level of the position being applied for. It is advisable to thoroughly prepare and revise various topics related to Java programming to increase the chances of success in a Java interview.。
java 英文面试题
java 英文面试题Java面试题1. What is Java?Java is a high-level programming language developed by Sun Microsystems (now owned by Oracle) in 1995. It is widely used for developing various applications, including web and mobile applications.2. What are the key features of Java?- Platform independence: Java programs can run on any system that has a Java Virtual Machine (JVM) installed.- Object-oriented: Java follows the object-oriented programming paradigm and supports concepts like encapsulation, inheritance, and polymorphism.- Robust: Java includes features like automatic memory management (garbage collection) and exception handling, which make it less prone to errors and crashes.- Secure: Java includes built-in security features that protect against viruses, tampering, and unauthorized access.- Multithreading: Java supports multithreading, allowing programs to execute multiple tasks concurrently.- Portable: Java programs can be easily moved from one system to another without any modification.3. What is the difference between JDK, JRE, and JVM?- JDK (Java Development Kit): It includes the tools necessary for developing and running Java applications. It includes the Java compiler, debugger, and other development utilities.- JRE (Java Runtime Environment): It provides the necessary runtime environment for executing Java applications. It includes the JVM and Java libraries.- JVM (Java Virtual Machine): It is responsible for executing the Java bytecode. It provides a platform-independent execution environment for Java programs.4. What are the various access specifiers in Java?Java provides four access specifiers to control the visibility and accessibility of classes, methods, and variables:- public: Accessible from anywhere.- private: Accessible only within the same class.- protected: Accessible within the same class, package, and subclasses.- default (no specifier): Accessible within the same package.5. What are the primitive data types in Java?Java has eight primitive data types:- byte: 8-bit signed integer.- short: 16-bit signed integer.- int: 32-bit signed integer.- long: 64-bit signed integer.- float: 32-bit floating-point number.- double: 64-bit floating-point number.- boolean: true or false.- char: 16-bit Unicode character.6. What is the difference between an interface and an abstract class?- An interface is a completely abstract class that defines a contract for its implementing classes. It cannot have method implementations. In contrast, an abstract class can have both abstract and non-abstract methods.- A class can implement multiple interfaces, but it can only extend a single abstract class.- Interfaces are used to achieve multiple inheritance in Java, while abstract classes provide a way to partially implement a class.7. What is the purpose of the "final" keyword in Java?The "final" keyword in Java is used to restrict certain behaviors:- A final class cannot be inherited.- A final method cannot be overridden by subclasses.- A final variable cannot be reassigned once initialized.8. What are the differences between checked and unchecked exceptions in Java?- Checked exceptions are checked at compile-time, and the compiler forces the developers to handle them using try-catch blocks or by declaring them in the method signature. Examples include IOException and SQLException.- Unchecked exceptions do not require mandatory handling and are checked at runtime. Examples include NullPointerException and ArrayIndexOutOfBoundsException.9. What are the benefits of using Java generics?- Type safety: Generics allow you to enforce compile-time type checking, preventing type-related errors at runtime.- Code reusability: With generics, you can write a single generic method or class that can work with various types, reducing code duplication.- Performance: Generics can improve performance by eliminating the need for type casting, which can be expensive in terms of memory and processing time.10. What is the difference between method overloading and method overriding?- Method overloading occurs when a class has multiple methods with the same name but different parameters. The methods are differentiated basedon the number, order, and types of parameters.- Method overriding occurs when a subclass provides a different implementation of a method already defined in its superclass. The methodsignature (name and parameters) must be the same in both the superclass and subclass.In conclusion, these are some common Java interview questions that cover various aspects of the Java programming language. It is important to understand these concepts thoroughly to succeed in a Java interview.。
java英语笔试试题及答案
java英语笔试试题及答案Java英语笔试试题及答案1. What is the difference between a class and an object in Java?A class is a blueprint or template that defines the properties and methods of an object. An object is an instance of a class, created at runtime.2. What is the purpose of the 'public static voidmain(String[] args)' method in Java?The 'public static void main(String[] args)' method is the entry point of a Java application. It is the first methodthat gets executed when the program starts.3. What is the difference between a method and a function in Java?In Java, a method is a block of code that is used to perform a specific task. A function is a term that is often used interchangeably with method, but technically, a function can return a value whereas a method does not necessarily do so.4. What is the 'this' keyword used for in Java?The 'this' keyword in Java is a reference to the current object. It can be used to access instance variables and methods of the current object.5. What is an interface in Java?An interface in Java is a completely abstract class that can contain only abstract methods and constants. It is used to achieve abstraction and to define a contract for classes to implement.6. What is the difference between a checked exception and an unchecked exception in Java?A checked exception is a type of exception that a method must either handle with a try-catch block or declare it with the 'throws' keyword. An unchecked exception is not required to be handled or declared, and includes RuntimeException and its subclasses.7. What is the 'final' keyword used for in Java?The 'final' keyword in Java can be used in three different contexts: to declare a class as final (cannot be subclassed), to declare a method as final (cannot be overridden), or to declare a variable as final (cannot be reassigned).8. What is a constructor in Java?A constructor in Java is a special method that is used to initialize objects. It has the same name as the class and is called when an object is created.9. What is the purpose of the 'super' keyword in Java?The 'super' keyword in Java is used to refer to the parent class's methods and variables. It is often used in constructors to call a superclass's constructor.10. What is the difference b etween '==’ and 'equals()' inJava?The '==' operator is used to compare primitive data types by value and object references by reference, whereas the'equals()' method is used to compare objects by content, and it can be overridden to provide custom comparison logic.Answers:1. A class is a blueprint, an object is an instance of a class.2. It is the entry point of a Java application.3. A method is a block of code in Java, a function is a more general term and can return a value.4. It refers to the current object.5. An interface is an abstract class with only abstract methods and constants.6. Checked exceptions must be handled or declared, unchecked do not.7. It is used to declare classes, methods, or variables as final.8. It initializes objects.9. It refers to the parent class's methods and variables.10. '==' compares by value or reference, 'equals()' compares by content.。
Java英文面试题
Java英⽂⾯试题1.Q: What is HashMap and Map?A: Map is Interface and Hashmap is class that implements that.2.Q: Difference between HashMap and HashTable?A:HashMap allows null values as key and value whereas Hashtable doesnt allowHashMap is unsynchronized and Hashtable is synchronized.(All the elements in the HashMap and HashTable are not ordered).3.Q: Difference between Vector and ArrayList?A: Vector is synchronized whereas arraylist is not.(All the elements in the Vector and ArrayList are ordered).4.Q: What if I write static public void instead of public static void?A: Program compiles and runs properly.5.Q: What is the difference between an Interface and an Abstract class?A: The interface is mainly used for framework design.An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly public and abstract .The abstract class is mainly used for code reuse and interface implementation.An abstract class can have instance methods that implement a default behavior.The methods can be declared as public ,private, protected; An abstract class can also declare some variables and construction methods and staic methods, but cannot have abstract construction methods and abstract staic methods.(接⼝和抽象类接⼝更多的是在系统架构设计⽅法发挥作⽤,主要⽤于定义模块之间的通信契约。
java-language
3)建议:嵌套层数越少越好,能用一层就不用两层,能用两层就不用三层
若需求必须要使用三层以上的循环才能解决,说明设计有问题
4)break只Байду номын сангаас跳出一层循环
5.程序=算法+数据结构------------了解
1)算法:解决问题的流程/步骤(顺序、分支、循环)
2)数据结构:将数据按照某种特定的结构来保存
数怎么存
设计良好的/合理的数据结构会导致好的算法
6.数组:
1)是一种数据类型(引用类型)
2)相同数据类型元素的集合
3)数组的定义:
int[] arr = new int[10];
4)数组的初始化:
4.4)可以中文命名,但不建议
建议"英文的见名知意"、"驼峰命名法"
2.基本数据类型:共8种
1)int:整型,4个字节,-21个多亿到21个多亿
1.1)整数直接量默认为int型,但不能超范围,超范围则编译错误
1.2)两个整数相除,结果还是整数,小数位无条件舍弃(不会四舍五入)
int[] arr = new int[3]; //0,0,0
int[] arr = {2,5,8}; //2,5,8
int[] arr = new int[]{2,5,8}; //2,5,8
int[] arr;
arr = {2,5,8}; //编译错误,此方式只能声明同时初始化
public class BubbleSort {
public static void main(String[] args) {
/*
* 1)声明整型数组arr,包含10个元素
java 英语面试题(各外企java英文面试题汇总-100问)
java 英语面试题(各外企java英文面试题汇总-100问)Question:What is the difference between an Interface and an Abstract class?Question: What is the purpose of garbage collection in Java, and when is it used?Question: Describe synchronization in respect to multithreading.Question: Explain different way of using thread?Question: What are pass by reference and passby value?Question: What is HashMap and Map?Question: Difference between HashMap and HashTable?Question: Difference between Vector and ArrayList?Question: Difference between Swing and Awt?Question: What is the difference between a constructor and a method?Question: What is an Iterator?Question: State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.Question: What is an abstract class?Question: What is static in java?Question:What is final?Question: What if the main method is declared as private?Question: What if the static modifier is removed from the signature of the main method?Question: What if I write static public void instead of public static void?Question: What if I do not provide the String array as the argument to the method?Question: What is the first argument of the String array in main method?Question: If I do not provide any arguments on the command line, then the String array of Main method will be empty or null?Question: How can one prove that the array is not null but empty using one line of code?Question: What environment variables do I need to set on my machine in order to be able to run Java programs?Question: Can an application have multiple classes having main method?Question: Can I have multiple main methods in the same class?Question: Do I need to import ng package any time? Why ?Question: Can I import same package/class twice? Will the JVM load the package twice at runtime?Question: What are Checked and UnChecked Exception?Question: What is Overriding?Question: What are different types of inner classes?Question: Are the imports checked for validity at compile time? e.g. will the code containing an import such as ng.ABCD compile?Question: Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?Question: What is the difference between declaring a variable and defining a variable?Question: What is the default value of an object reference declared as an instance variable?Question: Can a top level class be private or protected?Question: What type of parameter passing does Java support?Question: Primitive data types are passed by reference or pass by value?Question: Objects are passed by value or by reference?Question: What is serialization?Question: How do I serialize an object to a file?Question: Which methods of Serializable interface should I implement?Question: How can I customize the seralization process? i.e. how can one have a control over the serialization process?Question: What is the common usage of serialization?Question: What is Externalizable interface?Question: When you serialize an object, what happens to the object references included in the object?Question: What one should take care of while serializing the object?Question: What happens to the static fields of a class during serialization?Question: Does Java provide any construct to find out the size of an object?Question: Give a simplest way to find out the time a method takes for execution without using any profiling tool?Question: What are wrapper classes?Question: Why do we need wrapper classes?Question: What are checked exceptions?Question: What are runtime exceptions?Question: What is the difference between error and an exception??Question: How to create custom exceptions?Question: If I want an object of my class to be thrown as an exception object, what should I do?Question: If my class already extends from some other class what should I do if I want an instance of my class to be thrown as an exception object?Question: How does an exception permeate through the code?Question: What are the different ways to handle exceptions?Question: What is the basic difference between the 2 approaches to exception handling...1> try catch block and 2> specifying the candidate exceptions in the throws clause?When should you use which approach?Question: Is it necessary that each try block must be followed by a catch block?Question: If I write return at the end of the try block, will the finally block still execute?Question: If I write System.exit (0); at the end of the try block, will the finally block still execute?Question: How are Observer and Observable used?Question: What is synchronization and why is it important?Question: How does Java handle integer overflows and underflows?Question: Does garbage collection guarantee that a program will not run out of memory?Question: What is the difference between preemptive scheduling and time slicing? Question: When a thread is created and started, what is its initial state? Question: What is the purpose of finalization?Question: What is the Locale class?Question: What is the difference between a while statement and a do statement? Question: What is the difference between static and non-static variables? Question: How are this() and super() used with constructors?Question: What are synchronized methods and synchronized statements?Question: What is daemon thread and which method is used to create the daemon thread? Question: Can applets communicate with each other?Question: What are the steps in the JDBC connection?Question: How does a try statement determine which catch clause should be used to handle an exception?Question: Is Empty .java file a valid source file?Question: Can a .java file contain more than one java classes?Question: Is String a primitive data type in Java?Question: Is main a keyword in Java?Question: Is next a keyword in Java?Question: Is delete a keyword in Java?Question: Is exit a keyword in Java?Question: What happens if you dont initialize an instance variable of any of the primitive types in Java?Question: What will be the initial value of an object reference which is defined as an instance variable?Question: What are the different scopes for Java variables?Question: What is the default value of the local variables?Question: How many objects are created in the following piece of code?MyClass c1, c2, c3;c1 = new MyClass ();c3 = new MyClass ();Question: Can a public class MyClass be defined in a source file named YourClass.java?Question: Can main method be declared final?Question: What will be the output of the following statement?System.out.println ("1" + 3);Question: What will be the default values of all the elements of an array defined as an instance variable?Question: Can an unreachable object become reachable again?Question: What method must be implemented by all threads?Question: What are synchronized methods and synchronized statements?Question: What is Externalizable?Question: What modifiers are allowed for methods in an Interface?Question: What are some alternatives to inheritance?Question: What does it mean that a method or field is "static"? ?Question: What is the difference between preemptive scheduling and time slicing? Question: What is the catch or declare rule for method declarations?。
Java初级开发工程师Spring Boot方面的面试题含解答共20道题
Java初级开发工程师Spring Boot方面的面试题含解答共20道题1. 什么是Spring Boot?答:Spring Boot是Spring框架的一项子项目,用于简化Spring应用程序的开发和部署,提供自动配置、开箱即用的功能和生产就绪的特性。
2. Spring Boot与传统Spring应用程序的主要区别是什么?答:Spring Boot提供了自动配置、内嵌服务器、开箱即用的功能,使得开发和部署Spring 应用程序更加简单,无需繁琐的配置。
3. 什么是Spring Boot的自动配置(Auto-Configuration)?答:Spring Boot的自动配置是一种机制,根据应用程序的依赖和类路径自动配置Spring Beans,以减少手动配置的工作。
4. 什么是Starter(启动器)依赖?答:启动器是一组预定义的依赖,用于快速引入常见功能和库,例如Spring Boot Web Starter用于构建Web应用程序。
5. 如何创建一个Spring Boot应用程序?答:您可以使用Spring Initializr(https://start.spring.io/)生成Spring Boot项目的初始结构,或者使用Spring Boot CLI命令行工具。
6. Spring Boot应用程序的入口点是什么?答:Spring Boot应用程序的入口点是主应用程序类(Main Application Class),通常包含`public static void main`方法。
7. 什么是Spring Boot的配置文件(application.properties或application.yml)?如何使用它们?答:Spring Boot的配置文件用于定义应用程序的配置属性,可以在`src/main/resources`目录下创建,并通过属性文件或YAML格式进行配置。
8. 什么是Spring Boot Actuator?它的作用是什么?答:Spring Boot Actuator是Spring Boot的一个模块,用于提供应用程序的监控和管理功能,包括健康检查、性能监视和环境信息。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
英文Java面试题Question: What is transient variable?Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null.Question: Name the containers which uses Border Layout as their default layout?Answer: Containers which uses Border Layout as their default are: window, Frame and Dialog classes.Question: What do you understand by Synchronization?Answer: Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption.E.g. Synchronizing a function:public synchronized void Method1 () {// Appropriate method-related code.}E.g. Synchronizing a block of code inside a function:public myFunction (){synchronized (this) {// Synchronized code here.}}Question: What is Collection API?Answer: The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces.Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.Example of interfaces: Collection, Set, List and Map.Question: Is Iterator a Class or Interface? What is its use?Answer: Iterator is an interface which is used to step through the elements of a Collection.Question: What is similarities/difference between an Abstract class and Interface?Answer: Differences are as follows:Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.Interfaces are slow as it requires extra indirection to find corresponding method in the actual class. Abstract classes are fast.Similarities:Neither Abstract classes or Interface can be instantiated.Question: How to define an Abstract class?Answer: A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.Example of Abstract class:abstract class testAbstractClass {protected String myString;public String getMyString() {return myString;}public abstract string anyAbstractFunction();}Question: How to define an Interface?Answer: In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.Emaple of Interface:public interface sampleInterface {public void functionOne();public long CONSTANT_ONE = 1000;}Question: Explain the user defined Exceptions?Answer: User defined Exceptions are the separate Exception classes defined by the user for specific purposed. An user defined can created by simply sub-classing it to the Exception class. This allows custom exceptions to be generated (using throw) and caught in the same way as normal exceptions.Example:class myCustomException extends Exception {// The class simply has to exist to be an exception}Question: Explain the new Features of JDBC 2.0 Core API?Answer: The JDBC 2.0 API includes the complete JDBC API, which includes both core and Optional Package API, and provides inductrial-strength database computing capabilities.New Features in JDBC 2.0 Core API:Scrollable result sets- using new methods in the ResultSet interface allows programmatically move the to particular row or to a position relative to its current positionJDBC 2.0 Core API provides the Batch Updates functionality to the java applications.Java applications can now use the ResultSet.updateXXX methods.New data types - interfaces mapping the SQL3 data typesCustom mapping of user-defined types (UTDs)Miscellaneous features, including performance hints, the use of character streams, full precision for java.math.BigDecimal values, additional security, and support for time zones in date, time, and timestamp values.Question: Explain garbage collection?Answer: Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program cann't directly free the object from memory, instead it is the job of the garbage collector to automatically free the objects that are no longer referenced by a program. Every class inherits finalize() method from ng.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. I Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.Question: How you can force the garbage collection?Answer: Garbage collection automatic process and can't be forced.Question: What is OOPS?Answer: OOP is the common abbreviation for Object-Oriented Programming.Question: Describe the principles of OOPS.Answer: There are three main principals of oops which are called Polymorphism, Inheritance andEncapsulation.Question: Explain the Encapsulation principle.Answer: Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.Question: Explain the Inheritance principle.Answer: Inheritance is the process by which one object acquires the properties of another object.Question: Explain the Polymorphism principle.Answer: The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as "one interface, multiple methods".Question: Explain the different forms of Polymorphism.Answer: From a practical programming viewpoint, polymorphism exists in three distinct forms in Java:Method overloadingMethod overriding through inheritanceMethod overriding through the Java interfaceQuestion: What are Access Specifiers available in Java?Answer: Access specifiers are keywords that determines the type of access to the member of a class. These are:PublicProtectedPrivateDefaultsQuestion: Describe the wrapper classes in Java.Answer: Wrapper class is wrapper around a primitive data type. An instance of a wrapper classcontains, or wraps, a primitive value of the corresponding type.Following table lists the primitive types and the corresponding wrapper classes:Primitive Wrapperboolean ng.Booleanbyte ng.Bytechar ng.Characterdouble ng.Doublefloat ng.Floatint ng.Integerlong ng.Longshort ng.Shortvoid ng.VoidQuestion: Read the following program:public class test {public static void main(String [] args) {int x = 3;int y = 1;if (x = y)System.out.println("Not equal");elseSystem.out.println("Equal");}}What is the result?A. The output is equal?br>B. The output in not Equal?br>C. An error at " if (x = y)" causes compilation to fall.D. The program executes but no output is show on console.Answer: CQuestion: what is the class variables ?Answer: When we create a number of objects of the same class, then each object will share a common copy of variables. That means that there is only one copy per class, no matter how many objects are created from it. Class variables or static variables are declared with the static keyword in a class, but mind it that it should be declared outside outside a class. These variables are stored in static memory. Class variables are mostly used for constants, variable that neverchange its initial value. Static variables are always called by the class name. This variable is created when the program starts i.e. it is created before the instance is created of class by using new operator and gets destroyed when the programs stops. The scope of the class variable is same a instance variable. The class variable can be defined anywhere at class level with the keyword static. It initial value is same as instance variable. When the class variable is defined as int then it's initial value is by default zero, when declared boolean its default value is false and null for object references. Class variables are associated with the class, rather than with any object.Question: What is the difference between the instanceof and getclass, these two are same or not ?Answer: instanceof is a operator, not a function while getClass is a method of ng.Object class. Consider a condition where we useif(o.getClass().getName().equals("ng.Math")){ }This method only checks if the classname we have passed is equal to ng.Math. The class ng.Math is loaded by the bootstrap ClassLoader. This class is an abstract class.This class loader is responsible for loading classes. Every Class object contains a reference to the ClassLoader that defines. getClass() method returns the runtime class of an object. It fetches the java instance of the given fully qualified type name. The code we have written is not necessary, because we should not compare getClass.getName(). The reason behind it is that if the two different class loaders load the same class but for the JVM, it will consider both classes as different classes so, we can't compare their names. It can only gives the implementing class but can't compare a interface, but instanceof operator can.The instanceof operator compares an object to a specified type. We can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface. We should try to use instanceof operator in place of getClass() method. Remember instanceof opeator and getClass are not same. Try this example, it will help you to better understand the difference between the two.Interface one{}Class Two implements one {}Class Three implements one {}public class Test {public static void main(String args[]) {one test1 = new Two();one test2 = new Three();System.out.println(test1 instanceof one); //trueSystem.out.println(test2 instanceof one); //trueSystem.out.println(Test.getClass().equals(test2.getClass())); //false}}* Q1. How could Java classes direct program messages to the system console, but error messages, say to a file?.The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);* Q2. What's the difference between an interface and an abstract class?A. An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.* Q3. Why would you use a synchronized block vs. synchronized method?A. Synchronized blocks place locks for shorter periods than synchronized methods.* Q4. Explain the usage of the keyword transient?A. This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).* Q5. How can you force garbage collection?A. You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.* Q6. How do you know if an explicit object casting is needed?A. If you assign a superclass object to a variable of a subclass's data type, you need to do explicit casting. For example:Object a; Customer b; b = (Customer) a;When you assign a subclass to a variable having a supeclass type, the casting is performed automatically.* Q7. What's the difference between the methods sleep() and wait()A. The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or n otifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.* Q8. Can you write a Java class that could be used both as an applet as well as an application?A. Yes. Add a main() method to the applet.* Q9. What's the difference between constructors and other methods?A. Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.* Q10. Can you call one constructor from another if a class has multiple constructorsA. Yes. Use this() syntax.* Q11. Explain the usage of Java packages.A. This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.* Q12. If a class is located in a package, what do you need to change in the OS environment to be able to use it?A. You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:\dev\com\xyz\hr\Employee.java. In this case, you'd need to add c:\dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:c:\>java com.xyz.hr.Employee* Q13. What's the difference between J2SDK 1.5 and J2SDK 5.0?A.There's no difference, Sun Microsystems just re-branded this version.* Q14. What would you use to compare two String variables - the operator == or the method equals()?A. I'd use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object.* Q15. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?A. Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.* Q16. Can an inner class declared inside of a method access local variables of this method?A. It's possible if these variables are final.* Q17. What can go wrong if you replace && with & in the following code:String a=null; if (a!=null && a.length()>10) {...}A. A single ampersand here would lead to a NullPointerException.* Q18. What's the main difference between a Vector and an ArrayListA. Java Vector class is internally synchronized and ArrayList is not.* Q19. When should the method invokeLater()be used?A. This method is used to ensure that Swing components are updated through the event-dispatching thread.* Q20. How can a subclass call a method or a constructor defined in a superclass?A. Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass's constructor.For senior-level developers:** Q21. What's the difference between a queue and a stack?A. Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule** Q22. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?A. Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.** Q23. What comes to mind when you hear about a young generation in Java?A. Garbage collection.** Q24. What comes to mind when someone mentions a shallow copy in Java?A. Object cloning.** Q25. If you're overriding the method equals() of an object, which other method you might also consider?A. hashCode()** Q26. You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use:ArrayList or LinkedList?A. ArrayList** Q27. How would you make a copy of an entire Java object with its state?A. Have this class implement Cloneable interface and call its method clone().** Q28. How can you minimize the need of garbage collection and make the memory use more effective?A. Use object pooling and weak object references.** Q29. There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it?A. If these classes are threads I'd consider notify() or notifyAll(). For regular classes you can use the Observer interface.** Q30. What access level do you need to specify in the class declaration to ensure that only classes from the same directory can access it?A. You do not need to specify any access level, and Java will use a default package access level.The J2EE questions are coming soon. Stay tuned for Yakov Fain on Live . Ask your questions to Yakov on the air!=====================IBM java 英文面试题1.what is oracle.2.what is major differenece oracle8i and oracle9i.4.tell me some thing ur self.5.please tell me about oops.6.what is single inheritance.7.what is multiple inheritance.8.can java support multiple inheritance.9.what is interface.10.what is differenec between abstract class and interface.11.how to u prove that abstrace class cannot instantiate directly.12.what is differenece between string and stringbuffer.13.what is immutable14.how to write a program using sort program.15 how to write a program using unsort program.16.what is legacy.17.what is legacy api18.what is legacy interface.19.what is main difference hashmap and hastable20.what is main difference between arraylist and vector.21.what is struts framework.22.what are distributed techonologies.23.what is advantage and disadvantage of distributed techonologies.24.what is main difference between jsp and servlets.25.what is difference between procedure and functions.26.what is jdbc.27.what are type of drivers.28.what is type 4 driver.29.how to collect requuirements form u r client.30.which process use in ur project.31.what is deployment descriptor.32.what is heirarchy of files in struts.33.please draw struts frame wrok.34.please draw j2ee architecture.35.please draw mvc-2 architecture.36.please draw that how design op module.37.how to find a file on linux.38.how to configure weblogic8.1 on linux.39.why you use struts framework in ur project.40.what is platfrom independent41.what is awt and swing.42.what is heavy wieght components.43.what is feature of weblgoic8.1.44.why you choose application server on linux and database server on aix.45.please tell me about ur project.46.what is major concepts in oops.47.why u choose mvc-2 architecture.48.what is implicit object.49.how many implicit objects in jsp50.why choose weblogic8.1 other than any applicationserver.51.what is water fall model vs sdlc52.what is use of dataflowdiagrams53.wha t is ip in ur project.54.what about reception module—————————————————————————————————————————————————————————1. Oracle is an RDBMS product with DDL and DML from a company called Oracle Inc.2. Difference between 8i and 9i is given in the Oracle site3. Question not available4. Something5. oops is Object Oriented Programming6.what is single inheritance.ans:one class is inherited by only other one class7.what is multiple inheritance.ans:One class inheriting more than one class at atime8.can java support multiple inheritance.ans:No9.what is interface.ans:Interface has only method declarations but no defn10.what is differenec between abstract class and interface.ans:In abstract class some methods may contain definition,but in interface every method should be abstract11.how to u prove that abstrace class cannot instantiate directly.ans:As they dont have constructor they cant be instantiated12.what is differenece between string and stringbuffer.ans:Strings are immutable where as string buffer can be modified13.what is immutableans:Which cant be changed14.how to write a program using sort program.15 how to write a program using unsort program.ans: Both can be done using javascriptThis is for Sortfunction SelectTextSort(obj) { // sort by textvar N=obj.options.length;for (var i=0;i<N-1;i++) {for (var j=i+1;j<N;j++) {if ( obj.options[i].text > obj.options[j].text ) {var i1= (obj.options[i].selected == true ) ? true : falsevar j1= (obj.options[j].selected == true ) ? true : falsevar q1 = obj.options[j].text;var q2 = obj.options[j].value;obj.options[j].text = obj.options[i].text;obj.options[j].value = obj.options[i].value;obj.options[i].text = q1;obj.options[i].value = q2;obj.options[i].selected = (j1 && true ) ? true : falseobj.options[j].selected = (i1 && true ) ? true : false}}}return true}16.what is legacy.17.what is legacy api18.what is legacy interface.ans: legacy is something that is old in terms of technology/ system19.what is main difference hashmap and hastableans:Hash table is synchronised20.what is main difference between arraylist and vector.ans:Vector is synchronised21.what is struts framework.22.what are distributed techonologies.distributed technologies means any technology / s/w program that are having many components in multiple environments that interact with each other depending on the functional requirements and design.23.what is advantage and disadvantage of distributed techonologies.overdependance on single platform / single language is avoided. Application can be built flexible to meet requirements. Division of labour is possible. Best of all the technologies and platforms can be optimally utilized. Complexity of requirements can be reduced.25.what is difference between procedure and functions.'ans:Fuctions can return value ,procedures cant return value26.what is jdbc.ans:Connecting to DB from java program requires JDBC27.what are type of drivers.type1,2,3,429.how to collect requuirements form u r client.is not a job of a technical person. It is better for a BA to do it.30.which process use in ur project.Generally u can say:Project related process: Analysis, Design, Sign-off Documents, Implementation, Integration, Testing, UATWork related process:Technical Design, Work Allocation, Code Review Checklist, Unit Test Form will be prepared by the Project Lead and given to the developer.Developer prepares the Unit Test CaseImplements Code, Performs TestSubmits Code through CVS / VSSSubmits documents along with Release Checklist to the tester / leader.31.what is deployment descriptor.ans:Which contains the infrnmation like which file to be used40.what is platfrom independentans:A language is said to be platform independent if it can be run on any machine with out modifying code41.what is awt and swing.ans:AWT are heavy weight components and swings are light weight components46.what is major concepts in oops.ans:Abstraction,polymorphism,encapsulation,inheritance47.why u choose mvc-2 architecture.ans:In MVC-2 controller is servlet rather than JSP which makes it efficient48.what is implicit object.ans:Implicit objects are a set of Java objects that the JSP Container makes available to developers in each page49.how many implicit objects in jspans:out,page,session,request,response,application,page context,config。