solid principles java

Learn about solid principles java, we have the largest and most updated solid principles java information on alibabacloud.com

Usage principles for various classes of IO streams in Java

(FR); - String ABC = br.readline ();//bufferedreader defines the ReadLine () method the //If you want to wrap, you need to generate the Br.newline () manually. - SYSTEM.OUT.PRINTLN (ABC); - */ - intRead =Fr.read (); + while(Read!=-1){ - Fw.write (read); +Read =Fr.read (); A } at fw.close (); - fr.close (); - LongEnd =System.currenttimemillis (); -SYSTEM.OUT.PRINTLN ("Time Consuming:" + (End-start) + "MS"); -}Catch(FileNotFoundExceptio

Basic principles and programming implementation of Java annotations

return value can be a complex object in Java, or it can be a basic type,Enumeration all lines * such as elementtype[] value (); */ The annotations are defined, how to use them, as follows publicclasstestmain{ @UserAnnotation (age=20,gender= "F", Id=2014,name= "Zhangsan")//use of annotations privateobjectobj;publicstaticvoidmain (String []args] throwsexception{filedobjfield= testmain.class.getfield ("obj");userannotationua= Objfield.getannotation (U

The Five Principles of Java

needs to implement multiple interfaces of the client program, then use multiple inheritance to achieve. These two methods are the whole method of implementing interface isolation, the second method is more common and simpler to use. The first method is relatively complex to use, and also produces duplicate objects in the process of using the delegate, which takes up the runtime and memory overhead. Sometimes the second method is necessary, and the first method is not available. For example, con

In-depth understanding of Java Virtual machines (JVM performance tuning + memory model + Virtual machine Principles) Video tutorial

distributed RESTful Service video tutorial First set:billions of traffic e-Commerce Details page System combat-cache Architecture + high-Availability service architecture + MicroServices Architecture (first edition)Second set:billions of traffic e-Commerce Details page System combat-cache Architecture + high-Availability service architecture + MicroServices Architecture (second edition)The third set:Elaticsearch Video Two sets-full version (core and advanced step)Elasticsearch Top Master Series

Design principles for I/O libraries in Java

component (Concretecomponent) role: Played by Chararraywriter, OutputStreamWriter, PipedWriter and StringWriter, They all implement the interface that reader declares.(3) abstract decoration (Decorator) role: Played by BufferedWriter, Filterwriter, and PrintWriter, they have the same interface as writer.(4) Specific decoration (concretedecorator) Role: It is merged with the abstract decorative character. Because of the merging of the abstract decorative characters with the specific decorative c

Java Generic Implementation Principles

strlist all belong to the same class.Create an object that can store only integers ArrayList , after the add an integer value, call add an ASD string with reflection, and run the add(Object o) code without error, and the result prints 1 and two values of ASD. In this case add(Integer o) , the codenosuchmethodexception exception is thrown by the runtime using the reflection call method. This fully proves that after compiling, the generic information of the integer is erased and only the original

Design principles in Architecture Interface Separation principle (ISP)-Java Development Technology-experience the beauty of design patterns and algorithms in architecture

: Interface high cohesion is internally highly dependent and isolated as much as possible. That is, the method of internal declaration of an interface is related to a sub-module, and is required by this submodule. Interface design is limited: If you fully follow the principle of interface separation, there will be a problem, that is, the design of the interface will be less and less, so that the number of interface increases, the complexity of the system increased suddenly, rather than the

Java Generics (i): Getting Started, principles, using

As far back as the JDK version 1.4, there was no concept of generics at that time. The code for Java programmers writing collection classes was similar to the following:List list = new ArrayList();list.add("www.cnblogs.com");list.add(23);String name = (String)list.get(0);Integer number = (Integer)list.get(1);By declaring a collection in code, we can put a variety of data into the collection, and cast it in a forced type when it is taken out.But in fac

Fundamentals and Basic principles of Java exception handling

exception before you can throw the exception without modifying the existing code. This ability is important when defining abstract base classes and interfaces so that derived classes or interface implementation classes can throw these pre-declared exceptions. 2. Why is there no throws in the method declaration, but the method body throws an exception? Exceptions inherited from RuntimeException can be thrown without exception description throws! For runtime exceptions (also known as non-checked

"Reprint" Java JVM operating mechanism and basic principles

constant pool, and all Str4 = = STR5 return True because they all point to the same object.In what case will the string object reference be automatically added to the string constant pool?//只有在这两种情况下会将对象引用自动加入到常量池String str1 = "aaa";String str2 = "aa"+"a";//其他方式下都不会将对象引用自动加入到常量池,如下:String str3 = new String("aaa");String str4 = New StringBuilder("aa").append("a").toString();StringBuilder sb = New StringBuilder();sb.append("aa");sb.append("a");String str5 = sb.toString();Well, the basic principle

Java Programming Principles

Objective: The object-oriented language of Java is in fact very consistent with the human life thinking pattern, because it takes object as its object of study, so-called "everything Objects". A man, an apple, an ant are all objects. Therefore, its design principles and design patterns are all around the object of thought condensed out of the idea of the essence, all with time stability. In this section we

Several principles of analysis on Java Chinese problems

unreasonable. For example, it is a more appropriate design to encapsulate the read and write methods of a database into a class, but it would be very unreasonable to implement the two methods of the class in two files respectively. So for 1, 2), 4 the method, although the implementation is relatively simple, but has some insurmountable shortcomings. This is also the reason that the relatively complex programming approach is popular. As opposed to Method 1, 2), 4), Method 3 has better pertinence

Three principles for effectively handling Java exceptions

Exceptions in Java provide a consistent mechanism for identifying and responding to error situations, and effective exception handling can make programs more robust and easy to debug. An anomaly is a powerful debugging tool that answers the following three questions: What went wrong? Where is the error? In the case of a valid use exception, the exception type answers "What" is thrown, the exception stack trace answers "where" thrown, the exception inf

Three principles for effectively handling Java exceptions

Exceptions in Java provide a consistent mechanism for identifying and responding to error situations, and effective exception handling can make programs more robust and easy to debug. An exception is a powerful debugging tool that answers the following three questions: What went wrong? Where's the mistake? Why is it wrong? In the case of a valid use exception, the exception type answers "What" is thrown, the exception stack trace

Java transaction learning notes (9)-in-depth analysis of JTA principles and implementation

Java transaction learning notes (9)-in-depth analysis of JTA principles and implementationThrough the study of java transactions in this series, I have a preliminary understanding of the concept of transactions. However, with the rapid development of the Internet, the data volume is growing explosively, common databases are increasingly becoming the performance b

Java Virtual machines and cross-platform principles

Java Virtual machines and cross-platform principles Java Virtual Machine (JVM) is an imaginary computer that can run Java bytecode, and the cross-platform of Java is relative to other programming languages, use C programming and execution to compare

Overview of Java's 23 design patterns and the principles of 6 design patterns

externally through the public method. This way, the class can be minimized when the dependent class changes. The least known principle is another way of saying it: communicate only with direct friends. As long as there is a coupling relationship between classes, it is called a friend relationship. Coupling are divided into dependencies, associations, aggregations, combinations, and so on. We call the class that appears as a member variable, method parameter, method return value as a direct frie

Java Memory management principles and memory area detailed

pointer two:Handle: The Java heap will draw a chunk of memory as the handle pool, and the reference stores the handle address of the object, and the handle contains the individual address information for the object instance data and the type data. :Direct pointer: The layout of the Java heap object considers how to place information about the access type data, which is the object address stored in the refe

Principles of Java binary compatibility

automatically work because redwineglass and glass are two different types. However, if we re-compile example2, the example of calling Bordeaux will become "invokevirtual sommelier/fetchglass (lredwine;) lredwineglass ;". To sum up, we can summarize the following important principles of Java binary compatibility: (1) During compilation, the Java compiler sele

Java concurrency mechanism and underlying implementation principles

The Java code is compiled into Java bytecode, bytecode is loaded into the JVM by the ClassLoader, and the JVM performs bytecode conversions to the assembly instructions on the CPU. The concurrency mechanism in Java relies on the implementation of the JVM and the instructions of the CPU.  The definition of volatile in the third edition of the

Total Pages: 8 1 .... 3 4 5 6 7 8 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.