Brief introduction:1, the concept of abnormalExceptions: Problems--abnormal---are encapsulated into objects;The object that Java describes to different abnormal situation is embodied; for serious exceptions, Java is described by the error class-------generally do not write targeted code to handle itfor non-critical unhandled exceptions,
Fully parse Java class loaders and fully parse java LoadsIn-depth understanding and exploration of Java class loading mechanism ----1. java. lang. ClassLoader class Introduction
{private String name = "Zhang San";p rivate int num1 = 1;public void outer () {System.out.println (name+ "" +num1);//syst Em.out.println (num2); The outer class cannot directly access the Inner class member Inner1 Inner1 = new Inner1 ();//The outer class can instantiate an inner class, access the Inner
The inner class of the member means that the bread in an outer class has a non-static class, for example:class outerclass{ // variables, function definitions ... class innerclass { // variable, function definition ... }} About the various uses of the members ' i
. The behavior of this convenient method is the same as that of C.addall (arrays.aslist (elements)) ,But in most implementations, this method can be much faster to run.import Java.util.arraylist;import java.util.arrays;import java.util.List; Public classCollectionsTest2 { Public Static voidMain (string[] args) {string[] str={"Hello","Nihao","say"," Love"}; Listarrays.aslist (str); ArrayList List2=NewArrayList (); List2.addall (List1); System. out. println (LIST2); }} Like on the point
Class Name Object name =new class name ();Class Name Object name This explanation is to create a class name class reference variable named "Object name"New; The explanation for this is the instantiation of the objectThe explanation of the
Command1.java file converted to class file: Javac-source 1.6-target 1.6 X.java (X.java is the file to be converted, the default is to generate a class file of the same name)Such as:
D:\java\studio\sdk\build-tools\22.0.1>javac-source 1.6-target 1.6 com/chaos/ha
Ck/AntiLazyLoad.java
2.
total instance object of classSystem.out.println (c1==C2); //The Third Way of expressionClass c3=NULL; Try{C3=class.forname ("Com.reflect.Foo"); } Catch(ClassNotFoundException e) {e.printstacktrace (); } System.out.println (C2==C3); //We can create instance objects of the class--> by the class type of the class, by creating an instance of Foo by C1 or C2 or C3.
Java inheritanceInheritance is the child class inherits the characteristics and behavior of the parent class, so that the subclass object (instance) has the parent class's instance domain and method, or the subclass inherits the method from the parent class, so that the subclass has the same behavior as the parent clas
1 keyword thisThe implicit parameter (Page 106,java core Technology), which represents the current class, is used internally within the class definition, distinguishing member variables and local variables with the This member variable name .2 class variable (static variable)--static identifierThe method of a static va
Common tool classes in Java string and MD5 encryption decryption class
We Java programmers in the development of projects are often used in a number of tool classes. Today I share my two tool classes that you can use in your project.
One, String tool class
Package com.itjh.javaUtil;
Import Java.io.ByteArrayInput
to the same object is true, only two objects that have a parent-child or peer relationship can be compared1System.out.println (NewInteger (1). Equals (NewInteger (1)));//true2 //because the integer compares the value, the integer class overrides the Equals method of the parent class of the object class3 //the method of the integer class aft
manipulating arrays in Java using the Arrays class
The Arrays class is a tool class provided in Java in the Java.util package. The class contains methods for manipulating arrays directly, such as sorting and searching directly, a
Java study notes 23 --- internal class local internal class can only access final local variables, study notes 23 ---
A local internal class is a class defined in the method body or code block. It has been briefly introduced in note 19.
Today we will discuss why local intern
Overview and methods of the date class are used* Overview of the A:date class* Class Date represents a specific moment, accurate to milliseconds.* B: Construction method* Public Date ()* Public date (long date)* C: Member method* Public long GetTime ()* public void SetTime (long time)DateFormat class* Overview of the A
Static internal abstract classes can be inherited.public class Testfather {public static void Main (string[] args) {Person.talk2 a = new Newtalk ();A.get ();Person Person1 = new Student ("Alice", 20, "female");System.out.println (Person1.talk ());/* Person Person2 = new person (); *///abstract class cannot be called}}Abstract class Person {String name;int age;Str
1. Abstract classes cannot be instantiated.2. Abstract classes can have constructors, which are inherited when the subclass must inherit a constructor of the parent class, and the abstract method cannot be declared static.3. Abstract methods only need to declare, without implementation, the abstract class can allow the normal method has the principal4. Classes that contain abstract methods must be declared
Common Java class libraries-Observer design patterns (Observable class Observer Interface) and observableobserver
Link: http://www.2cto.com/kf/201310/253013.html
To implement the Observer mode, you must rely on the Observable class and Observer interface provided in the java
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.