Are you looking for more than 6 K jobs to test your Java interview questions?

Source: Internet
Author: User
Tags xml parser

Test your Java basic test questions:

This is a few interview questions I designed. The requirement is that there should be as few questions as possible and they can be completed within five minutes, but it can basically reflect the level of knowledge of the interviewer. So I designed six questions.
If you are able to finish the test independently (without reading the materials or debugging the test) with an answer of more than 60 points, I will introduce you to a job of more than 6000 yuan.

1. Briefly describe the differences between logical operations (&, |, ^) and conditional operations (&, |. (15 points)

2. What will happen to the program running below? How can I correct an error? (15 points)

Interface {
Int x = 0;
}
Class B {
Int x = 1;
}
Class C
Extends B implements {
Public void PX (){
System. Out. println (X );
}
Public static void main (string [] ARGs ){
New C (). PX ();
}
}
}

3. Briefly describe the connection and difference between Java Server Page and servlet. (20 points)

4. How many forms does the XML document define? What are the essential differences between them?
How can I Parse XML documents? (20 points)

5. What are the similarities and differences between synchronized and Java. util. Concurrent. locks. Lock? (15 points)

6. What operations are prohibited in the EJB specification? (15 points)

The last question is your eyesight:

Public String tostring (){
Return this + "@" + this. hashcode ();
}

Is there any improper implementation of the tostring () method? (The tostring method can actually output some information about this class according to any content you want to output)

The following answers are for reference (not necessarily completely correct) and are not described in detail. You can refer to the relevant information and your understanding.

1. Briefly describe the differences between logical operations (&, |, ^) and conditional operations (&, |. (15 points)

There are two main differences:
A. Conditional operations can only operate on the boolean type, while logical operations can operate not only the boolean type, but also the numeric type.
B. logical operations will not generate short circuits. For example:

Int A = 0;
Int B = 0;

If (A = 3)> 0 | (B = 3)> 0) // after the operation a = 3, B = 0.
If (A = 3)> 0 | (B = 3)> 0) // after the operation, a = 3, B = 3.

5 points for the first point and 10 points for the second point.
This topic examines the most basic knowledge, but there are still a lot of developers downloading. The basic knowledge of any language will be detailed at the beginning, but apart from learning the first language, no one is willing to spend five minutes reviewing the new language.

2. What will happen to the program running below? How can I correct an error? (15 points)

Interface {
Int x = 0;
}
Class B {
Int x = 1;
}
Class C
Extends B implements {
Public void PX (){
System. Out. println (X );
}
Public static void main (string [] ARGs ){
New C (). PX ();
}
}
}

This topic will cause an error during compilation (the error description varies with the JVM, meaning that the unspecified x call matches both of them, just as importing Java at the same time. util and Java. when two SQL packages are declared, the date is the same)

This topic mainly describes the most basic structure of interfaces and classes. for the variables of the parent class, you can use super. x, and the interface property is implicitly public static final by default. therefore, you can use. x.

3. Briefly describe the connection and difference between Java Server Page and servlet. (20 points)

Needless to say in this question. When answering the same question, we should clearly know that JSP compilation is "servlet-like" rather than "servlet". When answering the difference, we should answer the question "focusing on (View/control logic) ". you can add or subtract other values based on your needs. the knowledge is very simple, but from the interview perspective, the subjects should not only be able to know their differences, but also be able to express them more accurately (to write a document later, they should be able to understand it, does not produce ambiguity), the answer "after JSP compilation is servlet" is regarded as an error, the answer "JSP is used for view, servlet is used for control logic" is considered as an error, should be focused on, mainly (majority) used for the expression of other words.

4. How many forms does the XML document define? What are the essential differences between them?

How can I Parse XML documents? (20 points)
Three answers to this question:
A: Two forms of DTD, schema
B: essential difference: the schema itself is XML and can be parsed by the XML Parser (which also develops the schema from the DTD)
Root purpose)
C: two main methods: Dom and sax. two methods are used to obtain the full score, such as saxt or others (based on Dom and sax, if the examinee thinks that other methods can also be considered as XML parsing, it should be allowed. however, the Dom is not answered, and the other method is described as "no score for XML parsing") should be added.

5. What are the similarities and differences between synchronized and Java. util. Concurrent. locks. Lock? (15 points)

Main similarities:
Lock can complete all functions implemented by synchronized. (others are not important)
Main differences:
Lock has more accurate thread semantics and better performance than synchronized (in the same point, this can also be answered)
Synchronized Automatically releases the lock. The lock must be manually released by the programmer. It must be in the finally clause.
Release, if not answered in finally release does not score, just as connection does not close one in finally
Example: I can't even release the most basic resources. I want to talk about multi-thread programming.

6. What operations are prohibited in the EJB specification? (15 points)

A total of 8 points, the answer is the full score of the following 3-4 points.
1. threads and thread APIs cannot be operated (thread APIs refer to methods of non-thread objects, such as notify and wait)
2. AWT cannot be operated.
3. cannot implement Server Functions
4. The static owner cannot survive.
5. You cannot use Io operations to directly access the file system.
6. The local database cannot be loaded.
7. This cannot be used as a variable or returned.
8. It cannot be called cyclically.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.