发布日期:2023-03-31来源:武汉北大青鸟武汉校区作者:武汉宏鹏
大家都知道在面试Java工程师的过程中,完美解答面试题是非常重要的,只有通过了这一关,才会进入面试环节。华为公司想必大家都渴望进入,今天小编就给大家透露下华为公司的Java面试题,助大家顺利进名企!
部分:选择题
QUESTION NO: 1
1、publicclass Test {
public static void changeStr(Stringstr){
str="welcome";
}
public static void main(String[] args){
String str="1234";
changeStr(str);
System.out.println(str);
}
}
Please write the output result :
QUESTION NO:2
1. 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')&&(i<2); foo('C')){
9. i++ ;
10. foo('D');
12. }
13. }
14. }
What is the result?
A. ABDCBDCB
B. ABCDABCD
C. Compilation fails.
D. An exception is thrown at runtime.
QUESTION NO: 3
1. class A {
2. protected int method1(int a, int b){ return 0; }
3. }
Which two are valid in a class thatextends 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: 4
1. public class Outer{
2. public void someOuterMethod() {
3. // Line 3
4. }
5. public class Inner{}
6. public static void main(String[]argv ) {
7. Outer o = new Outer();
8. // Line 8
9. }
10. }
Which instantiates an instance ofInner?
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//newOuter().new Inner()
QUESTION NO: 5
Which method is used by a servlet lace its session ID in a URL that is written to the servlet’s response outputstream?
A. The encodeURL method of theHttpServletRequest interface.
B. The encodeURL method of theHttpServletResponse interface.
C. The rewriteURL method of theHttpServletRequest interface.
D. The rewriteURL method of theHttpServletResponse interface.
QUESTION NO: 6
Which two are equivalent? (Choose two)
A.
B.
C.
D.
E.
F.
G.
QUESTION NO: 7
Which of the following statementsregarding the lifecycle of a session bean are correct?
1. java.lang.IllegalStateException isthrown if SessionContext.getEJBObject() is invoked when a stateful session beaninstance is passivated.
2. SessionContext.getRollbackOnly()does not throw an exception when a session bean with bean-managed transactiondemarcation is activated.
3. An exception is not thrown whenSessionContext.getUserTransaction() is called in the afterBegin method of abean with container-managed transactions.
4. JNDI access to java:comp/env ispermitted in all the SessionSynchronization methods of a stateful session beanwith container-managed transaction demarcation.
5. Accessing resource managers in theSessionSynchronization.afterBegin method of a stateful session bean withbean-managed transaction does not throw an exception.
第二部分:概念题
1. 描述Struts体系结构?对应各个部分的开发工作主要包括哪些?
3. JSP有哪些内置对象和动作?它们的作用分别是什么?
4、SQL问答题
SELECT * FROM TABLE
和
SELECT * FROM TABLE
WHERE NAME LIKE '%%' AND ADDR LIKE '%%'
AND (1_ADDR LIKE '%%' OR 2_ADDR LIKE'%%'
OR 3_ADDR LIKE '%%' OR 4_ADDR LIKE '%%')
的检索结果为何不同?
5、SQL问答题
表结构:
1、 表名:g_cardapply
字段(字段名/类型/长度):
g_applyno varchar 8;//申请单号(关键字)
g_applydate bigint 8;//申请日期
g_state varchar 2;//申请状态
2、 表名:g_cardapplydetail
字段(字段名/类型/长度):
g_applyno varchar 8;//申请单号(关键字)
g_name varchar 30;//申请人姓名
g_idcard varchar 18;//申请人身份证号
g_state varchar 2;//申请状态
其中,两个表的关联字段为申请单号。
题目:
1、 查询身份证号码为440401430103082的申请日期
2、 查询同一个身份证号码有两条以上记录的身份证号码及记录个数
3、 将身份证号码为440401430103082的记录在两个表中的申请状态均改为07
4、 删除g_cardapplydetail表中所有姓李的记
当然,看完了题目一定要整理好正确答案!武汉北大青鸟光谷校区小编温馨提示。
Copyright (c) 2006-2023 武汉宏鹏教育咨询有限公司 版权所有 All Rights Reserved.