Method overloading of Java learning notes, dynamic method scheduling and abstract classes, and java learning notes
I. Method Overloading
If the method in the subclass has the same method name as the method in its superclass, it is called the method in the subclass to overload the methods in the superclass, especially when the method names and parameter types in t
1. Abstract class:(1). Concept: Abstract class is an abstraction of a thing, that is, a class pumping. An abstract class is an abstraction of the whole class as a whole, including attributes, behavior. Java abstract classes, like Java interfaces, are used to declare a new type. And as a starting point of the hierarchical structure of a type.(2). Format:
C
When a Java program is running, the Java Runtime system always carries the so-called Run-time type identification of all objects, known as Rtti. This information records the class to which each object belongs. A virtual machine typically uses Run-time type information to select the correct method to execute, and the class used to hold the type information is class. The class class encapsulates the state of
same, why the first demo inside the static block did not execute it? Let's take a series of questions to solve the problem.ExplainIf you are careful you can see a final modifier, yes, the result is that it works.public static final int X=6/2; this line of code, the Java virtual machine can know at compile time what the value of X, so at the compile time has put 3 in the constant pool , So when called in the Main method, the initialization of the clas
Abstract classes in java and java
Abstract class
Features:
1. When a method is declared to be unimplemented, the method is an abstract method and needs to be abstract modified.
Abstract methods must be defined in abstract classes. This class must also be abstract.
2. abstract class
One of the classes that deeply simulate the java Dynamic proxy implementation mechanism, java Dynamic
The previous blog was the most basic implementation of the dynamic proxy principle, because it fixed the interface, fixed the proxy method, and fixed the proxy type,The following blog series will gradually introduce java's dynamic proxy implementation principles.
JAVA-classes, objects, and packages, java objects
The most important feature of Java programming language is Object-Oriented Programming (OOP ).
A class is the description of an object, and an object is an instance of a class. An object consists of attributes and behaviors. An Attribute stone object has characteristics
There are a lot of similarities and similarities between interfaces and abstract classes, and many people have the question of why there must be interfaces instead of abstract classes, and in others, abstract classes rather than interfaces. Or, when considering the generalization of Java
There is an old saying in China: People gather together to group objects. java should be said to come to life rather than life. Therefore, we can also use this old Chinese sentence to Understand java.When talking about java, we should first talk about classes and objects. This is two clues from start to end in java, ju
instanceThis should be noted
Main () methodmain()method is static and java can be called when executing a method in a virtual machine main() without creating an main() instance of the class where the method resides, because there is a static modification.Exampleclass Demo{ // 定义静态的成员变量 static int x; int y; // 定义静态的成员方法,用来获取值 public static int getX(){ return x; } // 定义静态的成员方法,用来设置值 public static void setX(int newX){ x = newX; } public
assigns a value to the parent class reference variable in a polymorphic way Person New person () { publicvoid eat () { SYSTEM.OUT.PRINTLN ("I Ate");}; // Call the Eat Method p.eat ();Using an anonymous object, the subclass is defined with two steps to create a subclass object by one format at a time. Although it is a two-step process, the two steps are done together.Anonymous inner class is also an anonymous object if you do not define a variable referenceNew Person () {public void
Java learning interrupted more than half a month, today is the next study. Today we have learned about inner classes and exceptions, and here is today's summary.
First look at the inner class.
Define another class in a class, which is called an inner class or a built-in class (inner Class).
An inner class allows us to organize logically related sets of classes a
);
If year is a leap year, the method returns True, otherwise it returns false.
Java Object classThe Object class is in the Java.lang package and is the ancestor of all Java classes, and each class in Java is extended by it.
When you define a Java class, the Object cl
Abstract method: A method that does not have a method body in a class is an abstract method.Abstract classes: Classes that contain abstract methods are called abstract classes.||||||||| Abstract classes cannot be instantiated (new)Why use abstract methods?(The following is a personal view)Because in the idea of object-
;public class Anonymouseinnerclass{@SuppressWarnings ("deprecation")Public String getDate (date date){return date.tolocalestring ();}public static void Main (string[] args){Anonymouseinnerclass test = new Anonymouseinnerclass ();Print Date:String str = test.getdate (new Date ());System.out.println (str);System.out.println ("----------------");Using anonymous inner classesString str2 = test.getdate (New Date (){});//use curly braces, but do not fill in the content, the execution results and the a
the method inside the variable System.out.println ("outer class method variable" +nums);}} Call the inner class method new Inner (). print ();} public static void Main (string[] args) {new Outer1 (). print ();}} Anonymous inner class/** * Anonymous Inner class * 1. Must inherit an abstract class or interface * 2. Cannot have static modified member variables and methods, only final decoration * 3. The variables within the method must use the final decoration * 4. There is no access modifier * 5
Recent use of the time to look at the thought in Java feel again and see the first time look very differentNext, let's talk about the relationship between objects and references in Java, and the concept of inner classes.1. Everything in Java is an objectWhat is the operator object in
members are set internally.Different points:1, the general class has enough information to describe things. Abstract classes may not have enough information to describe things.2, abstract methods cannot be defined in general classes, only non-abstract methods can be determined. Abstract methods can be defined in abstract classes, and non-abstract methods can als
Original: http://www.csdn.net/article/2012-06-04/2806277Each Java programmer has a Java class ranking table of its own. This ranking table has no strict rules and no rules to follow, it depends entirely on the work of the Java project you are involved in. The following classes, without my introduction, are known to
enable PHP to access EJB Enterprise-class components, so MINIJ2EE provides a ejb-php compiler that compiles EJB components into PHP classes, making it easy to invoke EJB components in PHP programs, For example:
Require ("cart.php"); File://Cart.php is the PHP class definition of the cart EJB generated after you compile the cart EJB.
$home =new carthome (); FILE://creates the home interface for the EJB.
$objref = $home->create ($cart _name); file://Cr
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