The data types in Java can be divided into two categories:1. The basic data type, also known as the original data type. Byte,short,char,int,long,float,double,booleanThe comparison between them, applying the double equals sign (= =), compares their
Currently, to provide an interface for another project, the interface is implemented with an HTTP URL, and the initial idea is that another project is requesting with the jquery post.However, it is possible that another project is deployed on a
1.java.util.concurrent.locks packet inside the main interface Lock,condition,readwritelock, the main class is Reentrantlock,reentrantreadwritelock, Reentrantreadwritelock.readlock,reentrantreadwritelock.writelock,locksupportThe main methods in
Public: can be accessed by all classes (interfaces, members).Protected: can only be accessed by classes in this class, in the same package, and if accessed in other packages, it must be a subclass of the class to which the member belongs.Private:
Java object-oriented-method value passing and reference passingThe value of the method is passed:Value passing in a method changes the value of a variable to the extent that the method does not affect the outside:On the code:1
The Java object-oriented approachMethods are part of an object, also known as behavior;Let's start with a simple example:1 Packagecom.java1234.chap03.sec03;2 3 Public classPerson {4 5 voidspeak () {6System.out.println ("I am Zhang San");7
Java object-oriented-classes and objectsClass-to-object relationshipsWe take a popular example, such as human is a class, Zhang San this person is a specific human individual, that is, the object in Java, this is a class and object
1.NIO is the new API provided in Java 4, which is designed to solve the problem of traditional IO. is used to solve the problem of traditional IO.Used to solve the problem of traditional IO. Used to solve the problem of traditional IO. Blocked.2. In
1.Example: What is the value of 3-2.6==0.4? Perhaps at first glance, the feeling is to return true because 3-2.6=0.4,0.4==0.4;However, the above analysis is wrong in Java.Because the operation of floating-point numbers is imprecise in Java, 3-2.6=0.3
First, directly through the propertiesconfiguration to read value according to key.Second, the Superdiamond configuration parameters are injected into the spring configuration file, using spring to load.Third, configure Superdiamond (no parameters)
A class in Java is a template that describes the behavior and state of a class of objects.An object is an instance of a class in which the object has a State (property) and behavior (method). For example, a dog is an object, his state is his color,
1, members inside the class can not have a simple static method or property (if you want to define the properties of static must be final)2. To create an object of a member's inner class, you must first create an object of the outer class in the
Given an arbitrary-length Java array, the maximum number of integers in an array can be combined, such as {9,98,123,32} max is 99832123Importjava.util.Arrays; import java.util.Comparator; classTest { Public Static voidMain (String args[]) {int[]
Bufferedinputstream and Bufferedoutputstream: These two classes are based on InputStream and OutputStream added a buffer of buffers, so that the data is not directly written to the stream, Instead of writing to buffer and then flush it to the stream
3. When implementing TCP server side with thread pool, first create a ServerSocket instance, then create n threads, each thread loops repeatedly and receives the client connection from the (shared) ServerSocket instance. When multiple threads invoke
PackageCn.magicdu.algorithm;/*** Print Prime number * *@authorXiaoduc **/ Public classPrim { Public Static voidMain (string[] args) { for(inti=1;i){ if(IsPrime (i)) {System.out.println (i); } } } /*** Determine if it is a prime
PackageCn.magicdu.algorithm;Importjava.util.LinkedList;Importjava.util.List;/*** Out of the loop problem, count to a multiple of a number to go out of the loop, print the last remaining elements of the original position *@authorXiaoduc **/ Public
Writing high-quality code: 151 suggestions for improving Java programs (Chapter 1: multithreading and concurrency ___ suggestion 8th ~ 125), 151122Recommendation 122: Use a thread exception processor to Improve System Reliability
We need to write a
QuickHit project instance
Java object-oriented QuickHit project example
Game class: used to obtain random strings (randomly printed strings, and then input strings by players)
public class Game {private String sbString;Random random = new
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