20 Java-side questions from investment banks

question one: What's wrong with using HashMap in a multithreaded environment? Under what circumstances does the get () method produce an infinite loop? There is no problem with HashMap itself, and there is no problem depending on how you use it. For

Java Multithreading--Implement Runnable interface

Packageunit8;ImportJava.applet.Applet;ImportJava.awt.Label;ImportJava.awt.TextField; Public classTestrunnableextendsAppletImplementsrunnable{Label prompt1=NewLabel ("The first thread:"); Label Prompt2=NewLabel ("The second thread:"); TextField

Java Basics VI [exception handling] (read head first Java record)

when the program is running, we cannot guarantee that all the services and methods are correct, and if an error occurs, it will cause the program to crash, so you need to handle some predictable errors, throw an exception by throwing, and then use

Java Multi-Threading 6 (thread and communication)

Question 1:Why Wait () and notify () are methods in the object class, not methods in the thread class?A: Because the lock is an arbitrary object, in the object class, if the lock object is not arbitrary in the thread class. Question 2:Why Wait ()

Java Fundamentals (Knowledge points)

1.java has classes of overrides and overloads of 2 kinds: overloading is the same class, the method name is the same, the parameter differs from the method, and the overriding is that the subclass inherits the parent class method, and the rewrite

A summary of the end of the Qianfeng-java course of "changing millions of scenes"

Java Knowledge points:Object-oriented:Object-oriented is a kind of thoughtProgramming guidancePackaging:Object-oriented 2 large core:1. Class: Descriptive information, abstractFormat: [public/abstract/final] class name {PropertyConstruction

Java Web. XML Configuration Servlet

File name: "Simpleservlet.java"Package cn.mldn.lxh.servlet;//Defining packagesImport java.io.*;HttpServlet belongs to the Javax.servlet.http packageServletexception belongs to the Javax.servlet packageImport javax.servlet.*;//Importing

Future patterns in Java's multi-threading

Scenario: Thread A needs the execution result of thread B, but there is no need to wait for thread B to finish, this time we can get the future object, and wait for the end of thread B to take the real result. Defines realdata real data classes

Compute Bean's and (Java)

When there are too many properties in a bean, it is a very troublesome thing to calculate the sum of a bean's list, which can be solved with the reflection mechanism of Java, the code is as follows:

Java Multi-Threading 3 (thread safe)

Requirement: Simulate three windows and buy tickets at the same time.Problem 1:static modifies num to create only one copy in memory, or 3 copies are created.Issue 2: Thread safety issues. (The code weighs 1 in the red font)Cause: There are two or

Performance optimization of the Java reflection mechanism

Importjava.lang.reflect.InvocationTargetException;ImportJava.lang.reflect.Method;ImportJava.util.HashMap;ImportJava.util.Map;ImportOrg.apache.log4j.Logger; Public classDynamicserver {Private StaticLogger log = Logger.getlogger (dynamicserver.class);

Java-version incorrect questions about installing multiple versions of the JDK

Problem Description:Today suddenly want to write a small application of socket communications, respectively, using bio, NIO, AIO way to achieve, to review the previous reading about TCP/UDP communication knowledge. The jdk1.8 was re-installed on the

Java Clone () deep copy, shallow copy

Cloneable interface is an empty interface, only for tagging objects, the Cloneable interface is not the Clone () method, the Clone () method is the method inside the object class! The default implementation is a native methodProtected native Object

Meaning of E, T, K, V, etc. in Java generics

Tokens in Java generics mean:E -Element (used in the collection because the element is stored in the collection)T -type (Java Class)K -Key (key)V -value (values)N -Number (numeric type)? -Represents an indeterminate Java typeS, U, V -2nd, 3rd, 4th

Java Map traversal mode performance analysis: Ketset and EntrySet

KeySet ():deposits all the keys in the map into the set collection. Because set has an iterator, you can take all the keys iteratively, and then get the value for each key based on the Get method, which only takes the key through get (). EntrySet ():

Example of a Java file name change

Public Static voidMain (string[] args) {File File=NewFile ("E:\\\\eclipse\\\\workspace\\\\helloworlddocker\\\\log"); //determine if the file directory exists, and is a file directory, non-file if(File.exists () &&file.isdirectory ()) {file[]

Some knowledge of object-oriented in Java (II.)

I. Explanation of the packageWhat is encapsulation? Why encapsulation? How to implement encapsulation?The purpose of encapsulation is to improve the security of the program. Encapsulation is a way to hide the attributes that you don't want the third

Java Development Tips

1 Loading the configuration fileWrite the configuration file config.properties in the SRC directory of the Common Java project (if MAVEN works in the project's Src/main/resources)

Java EE Spring

1, Spring has shaken the Sun's Java EE Traditional heavyweight framework (EJB) with its own power, becoming the most used Java EE Enterprise application development Framework.2, Spring is a layered Java EE application of a one-stop lightweight

Java Programming Thought learning note _5 (io Stream)

first, read characters with DataInputStreamYou can use the available method to see how many characters are available for access. examples are as follows: public class Test1 { publicstaticvoidthrows IOException { DataInputStreamin =new

Total Pages: 6206 1 .... 3664 3665 3666 3667 3668 .... 6206 Go to: GO

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.