Read about java programming quiz questions and answers, The latest news, videos, and discussion topics about java programming quiz questions and answers from alibabacloud.com
most cases, we only need to determine if the values are equal, and then compare them with the Equals method.There is also a equalsignorecase that can be used to ignore case comparisons. String s1 = "abc"; String s2 = "abc"; String s3= new String("abc"); System.out.println("s1 == s2 ? "+(s1==s2)); //true System.out.println("s1 == s3 ? "+(s1==s3)); //false System.out.println("s1 equals s3 ? "+(s1.equals(s3))); //true12. What is a string pool?As the name i
equalsignorecase that can be used to ignore case comparisons."ABC"; "abc"; String ("abc"); System.out.println (//true System.out.println (//false System.out.println (//true 12. What is a string pool?As the name implies, a string constant pool is used to store strings. It exists in the Java heap memory.Explains how a string pool exists in Java heap space and when we use different ways to cr
In this article we will discuss various types of face questions in a Java interview that will allow employers to test the candidate's Java and common object-oriented programming capabilities. The following chapters are divided into two, the first one will discuss object-oriented pr
method in a subclass that has the same name and parameters as its parent, we say that the method is overridden (override). When an object of a subclass uses this method, the definition in the subclass is called, and for it the definition in the parent class is "masked".
If more than one method with the same name is defined in a class, they either have a different number of arguments or have different parameter types, which is called a method overload (overload).The overloaded method is a ty
original address.Redirect is the server based on logic, send a status code, tell the browser to request the address again, in general, the browser will use all the parameters just requested again, so the session,request parameters can be obtained.3 The difference between a dynamic include and a static include in a JSPA collection of questions and answers about Java
solves this problem for us. After the online pool submits the callable task, a future object is returned, using which we can know the status of the callable task and get the result of the execution callable returned. The future provides a get () method so that we can wait for callable to end and get its execution results.What is Futuretask?Futuretask is a fundamental implementation of the future, and we can use it with executors to handle asynchronous tasks. Usually we do not need to use the Fu
-threaded access to shared resources, due to improper access, usually a thread locked a resource A, but also want to lock resource B, and in another thread, the lock resource B, but also to lock resource A to complete its own operations, two threads want the other's resources, Instead of releasing their own resources, two of threads are waiting for a situation that cannot be performed.Java Network Programming approximate process:UDP programmingSend si
multithreaded programs, multiple threads are executed concurrently to improve the efficiency of the program, and the CPU does not go idle because a thread needs to wait for resources. Multiple threads share heap memory, so creating multiple threads to perform some tasks is better than creating multiple processes. For example, Servlets is better than CGI because Servlets supports multithreading and CGI does not support it.How does the volatile keyword work in
The first one discusses object-oriented programming and its features, common questions about Java and its functionality, Java collection classes, garbage collectors, this chapter focuses on exception handling, Java applets, SWING,JDBC, remote method Invocation (RMI), servlet
First, let's talk about the differences between final, finally, and finalize. Second, can anonymous inner class (anonymous internal class) be extends (inherited) other classes, or implements (implemented) interface (Interface )? Third, the difference between static nested class and inner class is that the more you say, the better (the more general the interview questions are ). Fourth, the difference between and. Fifth, the difference between has
example, a landing page, using the PO mode, will create a LoginPage class, the class will define the user name input box, password input box, login button webelenentFor the corresponding element to implement the corresponding method, the input box is used to input, you need to create a user name and enter the password method, so that the real page consistent, so the design concept is PO mode. The pagefactory belongs to the PO mode, which is used to initialize the page Class of each PO pattern i
to Wangwei"$ Java-jar Blockchain-java-jar-with-dependencies.jar-add "Send 3.5 BTC to Wangwei"Print Blockchain$ Java-jar Blockchain-java-jar-with-dependencies.jar-printSummarizeIn this article we implement the Blockchain storage function, next we will implement the address, transaction, wallet, some of the functions of
statement in try {}, so will the code in finally {} following this try be executed? When will it be executed, before or after return?
Will be executed and executed before return.
28. Programming question: How can I calculate 2 by 8 in the most efficient way?
Programmers with a C background are particularly fond of asking such questions.
2
29. The two objects have the same value (X. Equals (y) = true), but
Java Multithreaded interview questions
1. What is the difference between processes and threads?
A process is a stand-alone (self contained) operating environment that can be viewed as a program or an application. A thread is a task that is performed in a process. The Java Runtime environment is a single process that contains different classes and programs. Thre
return statement in try {}, so will the code in finally {} following this try be executed? When will it be executed, before or after return?
Will be executed, before return.
28th. Programming question: how many equals 2x8 in the most efficient way?
Programmers with a C background are particularly fond of asking such questions.
29th, the two objects have the same value (X. Equals (y) = true), but diffe
?
What is Futuretask?
How to wake up a blocked thread?
How do immutable objects help with multithreading?
What does multi-threaded context switching mean?
What thread scheduling algorithms are used in Java?
What is the role of Thread.Sleep (0)?
What is the Java memory model, which areas are thread-shared, and which are unshared
What are optimistic and pessimistic locks?
Why do I synchroniz
overloading.
25th, can you inherit the string class?
The string class is a final class and therefore cannot be inherited.
26th, when a thread enters an synchronized method of an object, can other threads enter other methods of this object?
No, one synchronized method of an object can only be accessed by one thread.
27th, there is a return statement in try {}, so will the code in the finally {} after this try be executed, when it is executed, before or after it?
Will execute, before return.
. TreeSetthe largest and smallest elements can be obtained from.
Summary: Collections.sort() provides a list that is sorted once. PriorityQueueand TreeSet Dynamic maintenance of the ordered collection.9. Copy ListThere are two ways to copy a list. One is to use a ArrayList constructor.
1
ArrayListnewArrayList
The other is to use Collections.copy() .
12
ArrayListnewArrayListCollections.copy(dstList, srcList);
It is important to
we don't want to repeat, we should use set.
(2) Some collection classes allow the initial capacity to be specified, so if we can estimate the number of storage elements, we could use it to avoid a hash or resize.
(3) Based on interface programming, rather than on implementation programming, it allows us to easily change implementations later.
(4) Always use type-safe generics to avoid classcastexception
thread in the ready state by dispatching it to occupy the CPU and turn it into a running state. At this point, the system actually executes the thread's run () method.④ Blocking and waking threadsBlocking state (Blocked): A running thread enters a blocking state when it cannot continue running for some reason. These reasons include:(a) When a method of blocking type such as sleep () of a thread object is executed, the thread object is placed in a block set and waits for a timeout to automatical
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.