to write it as a separate class?The anonymous inner class is introduced at this time. Using an anonymous inner class implementation:1 Abstract classPerson {2 Public Abstract voideat ();3 }4 Public classDemo {5 Public Static voidMain (string[] args) {6 7 //Inherit Person class8 NewPerson () {9 Public voideat () {TenSystem.out.println ("Eat Something"); One } A }.eat (); - } -}As you can see, the anonymous class inherits the person cl
should overlap the hashcode () method.ToString () methodThe ToString () method is another important method defined in the object class, which is the string representation of the objects, and the syntax is:Public String toString ()The return value is a String type that describes the information about the current object. The ToString () method implemented in the object class returns the type and memory address information for the current object, but overrides it in some subclasses (such as String
in the character sequence of the object.
Setcharat (int n, char ch)
Replaces the character in the character sequence N of the current StringBuffer object with the character specified by the parameter ch, and the value of n must be non-negative and less than the length of the string sequence in the current object.
Reverse ()
Use the reverse () method to flip a sequence of characters in an object.
Delete (int n, int m)
Deletes a sequence
result set
3 if (Rs.next ()) {
4 rs.updatestring (2, ' Zhang Wei ');
5 Try {Rs.updaterow ();} Catch (Exception e) {}
6 } Three. Using the Preparestatement objectWhen creating SQL statements, use parameters temporarily. Represents a value, which is then generated by the SQL statement object and the Preparestatement object is then implemented to update the record by setting the actual parameters. Schematic code: 1 sql = "Update ksinfo set name =?" WHERE name = ' depo
//Superobj is not an instance of the Sonclass class6 if(SuperobjinstanceofSonclass) {7Sonclass sonObj1 =(Sonclass) superobj;8}Else{9System.out.println ("① cannot be converted");Ten } OneSuperobj =sonobj; A //Superobj is an instance of the Sonclass class - if(SuperobjinstanceofSonclass) { -Sonclass SonObj2 =(Sonclass) superobj; the}Else{ -System.out.println ("② cannot be converted"); - } - } + } - classsuperclass{} + classSonclassextendssupercl
) { ASystem.out.println ("I am an Object"); at } - if(objinstanceofpeople) { -System.out.println ("I am Human"); - } - if(objinstanceofTeacher) { -System.out.println ("I am a teacher"); in } - if(objinstanceofPresident) { toSystem.out.println ("I Am the headmaster"); + } - } the } * classpeople{} $ classTeacherextendspeople{}Panax Notoginseng classPresidentextendsteacher{}Operation Result:I am an objectI am a human being-----------I am
void write (int b)
Writes the low byte of parameter B to the output stream
void write (byte b[])
Writes all bytes in the array b[] to the output stream sequentially
void write (byte b[], int off, int len)
Writes the Len data starting with the Off+1 element in the array b[] to the output stream sequentially
Since both InputStream and OutputStream are abstract classes, the input stream objects created in the program are genera
"); the } *}Operation Result:My name is Xiao, teaching Java at Tsinghua University, with 12 years of seniorityI'm 70 years old, still standing on the podium and lecturing.Note: The construction method cannot be inherited, it is important to master this. A class can be constructed with only two methods: writing a constructor method, or not having a constructor at all, and the class has a default constructor.Series Articles:Java know how much (1) La
hierarchy 10-1.Figure 10-1 Top level hierarchy diagram for Java.io packageFor some frequent device interactions, the Java language system has booked 3 stream objects that can be used directly, namely:
System.in (standard input), which typically represents keyboard input.
System.out (standard output): usually written to the monitor.
System.err (standard error output): Usually written to the monitor.
The steps to use a byte stream and a character stream in the Java language
this example illustrates, your multithreaded routines are often locked, and deadlocks are the first thing you should check.Series Articles:Java know how much (top)Java know how much (interface) interfaceJava knows how much (40) the difference between an interface and an abstract classJava know how much (41) generic explanationJava
Work to know, air-conditioned office, not as noisy classroom.
Work to know that the University of Love is a game, now love is trading.
Work to know that sometimes a meal to eat thousands of pieces is also a need.
Work to know that students are pretending to be wealthy, the real rich are cry poor.
Work to
stop.")); A } +}Internal get (), wait () is called. This causes the execution to hang until the producer informs the data that it is ready. At this point, the internal get () is resumed execution. After getting the data, get () calls notify (). This tells producer that more data can be entered into the sequence. Within put (), wait () suspends execution until consumer takes the items in the sequence. When execution continues, the next data item is put into sequence, notify () is called, whi
of the method.
Implementation of method overloading:When the method name is the same, the compiler will match the number of parameters of the calling method, parameter type, etc. to select the corresponding method, if the match fails, then the compiler error, which is called overload resolution.Series Articles:Java know how much (1) Language overviewJava know how much (2) virtual machine (JVM) and cro
and highly layered? Does it look like you know the entire program architecture at a glance? The key here is indentation, and indentation can also be called a jump.The above code uses indentation: "public class math" is shelf, and then the Mian () method indents 4 spaces, the code inside the Mian () method is indented 8 spaces, and the print () method's body code is indented 4 more spaces. This way, the entire program's affiliation is obvious. The Mia
Why is it mentioned here is SEO experience to share, why not SEO some principles and basic knowledge? First of all, I have to admire some of the domestic SEO training institutions, SEO this industry in the domestic development of a few years, a variety of SEO training institutions are out of small, rely on SEO technology, not much money, But rely on SEO training fortune is quite a lot, have to say, seo, feed a lot of training "experts", sometimes, I also think of a problem, why China's SEO train
This article comes from a question and answer by Quroa "What is some time-saving tips that every Linux user should know?"--linux users have the skills to be aware of how to improve efficiency. I feel very good, summed up better, turn it over, and add some of their own understanding. First of all, I want to tell you that under Unix/linux, the most efficient technique is not manipulating the graphical interface, but command-line operations, because the
This article comes from a question and answer by Quroa "What is some time-saving tips that every Linux user should know?"--linux users have the skills to be aware of how to improve efficiency. I feel very good, summed up better, turn it over, and add some of their own understanding. First of all, I want to tell you that under Unix/linux, the most efficient technique is not manipulating the graphical interface, but command-line operations, because the
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.