The object to be saved is also saved. Generally, we only need to save the logical data. You can use the key word transient to mark the data that does not need to be saved. The following is an example: importjava. io. *; publicclassSerialimplementsSerializable {intcompany_id; Stringcompany_addr; transientboo J2SE
The object to be saved is also saved. Generally, we only need to save the logical data. You can use the key word transient to mark the data
J2SE basics: 12. IO stream Programming
Inheritance System:
1: byte stream
All streams ending with streams are byte streams. Byte streams are used to read binary data.
2: Ghost stream
All ends with reader/writer.
Write
Append (char c): Write character
Write (char [] cbuf)
Write (String str)
Write (int c)
Flush ()
Close ()
FileWrite (); used to operate files.
BufferWriter ();
Stream with buffer
TC1 = new Thread (c1); Tc1.start (); Tp1.start (); new Thread (New Producer (ss)). Start (); New Thread (New Consumer (ss)). Start ();}} Iii. Results of operationIv. Summary1.this.wait (), which holds the lock before calling wait,wait, is the thread that is accessing this object, wait, and the lock on this thread is lost after wait, only when the thread wakes up to retrieve the lock. Sleep locks are not lost.2.this.notify () wakes a thread on the current object that is being waitJAVA-
J2SE integration: This article analyzes the differences between the two exception types in the Java language-general Linux technology-Linux programming and kernel information. The following is a detailed description. Java provides two main types of exceptions: runtime exception and checked exception. All checked exceptions are derived from the java. lang. exception class, while the runtime Exception is derived from the java. lang. RuntimeException or
So, cheer !!! J2SE 5.0 beta has been released, including the implementation of JSR 201 (currently in the public review State). JSR 201 contains the new language feature: enum. I think I should try it. The following is the result. If you want to give it a try, come on.
In-depth
An example of defining and using enumeration types is listed here (from the JSR 201 document ).
Java code
Public class Card
{
Public enum Suit {HEART, DIAMOND, CLUB, SPADE };
P
you are welcome to join the Big data (HADOOP, SPARK, data Mining) Learning Exchange Group, to share big data materials, communicate with each other as the main qq:550174771Overloading of methodsYou can have multiple methods in a class that share the same name, as long as they have different parametersparameter types differ in number of parameters Package com.java2006; Public class computer { //Here static is the function of the method, in test can directly class name. Method access is not ac
-Java.lang.Byte
Java SE official API documentation-Java.lang.Boolean
Java SE official API documentation-Java.lang.Integer
We do not give all the packaging reference documents, please do your own Ctrl+F experience of the search process.This text link: https://www.shiyanlou.com/courses/111 This lesson is the experiment Building original course, reprint please specify. Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
animal, the rest of it is not visible. So we can consider that a is essentially pointing to the part of the heap memory that belongs to the animal class (that is, the yellow part). So in the main method, if you execute the commented out code "A.setfurcolor (" Yellow ")," or "System.out.println (A.furcolor), you will get an error.Therefore, when a reference to a parent class is directed to a subclass object, a reference to the parent class can only access the subset of properties and methods tha
Annotations (Annotations) are a major new feature in J2SE 5.0. In the future, the EJB 3.0 specification will fully utilize this feature to simplify the definition and implementation of Session Bean, Message-Driven Bean, and EntityBean.Java annotations are more or less affected by. NET. This is not to say that Java has no annotation. Previous annotations such as JavaDoc, especially @ deprecated, are annotations, but this update pushed the annotation to
This section explains the operator applicationThe Java calculation is divided into:Arithmetic operatorsOde value operatorlogical operatorsBitwise operatorsMeta operatorHere is a video explanation of the major types of operators, and there are exercises to provide youInterview questions:1. The most efficient way to figure out 2 times 8 equals a few?2. Swap the values of two integer variables (no third-party variables required)The answer is in the website forum-the third lesson after the exercise
student_method {// constructor public student_method () {system. out. println ("object constructor");} // object (member) method int divde (int x, int y) {return x/y ;} // class method static int sum (int x, int y) {return X + Y;} public static void main (string ARGs []) {// call the class method student_method.sum (2, 3); // call the member method // student_method.divde (2, 3); // The system cannot be called. out. println ("1111"); student_method test = new student_method (); system. out. pri
Source: http://www.study-code.com/java/j2se/66421.htm
// Use J2SEAPI to read Properties files
// 1. Example of the load () method using the java. util. Properties class:InputStreamin = lnewBufferedInputStream (newFileInputStream (name ));Propertiesp = newProperties ();P. load (in );
// 2. Example of using the getBundle () method of the java. util. ResourceBundle class:ResourceBundlerb = ResourceBundle. getBundle (name, Locale. getDefault ());
// 3. Ex
Currently, the Java 2 platform has three versions. These are the micro version of Java 2 platform (Java 2 platform Micro Edition, j2_based) applicable to small devices and smart cards) java 2 platform Standard Edition (j2se) for desktop systems and Java 2 Platform Enterprise Edition (Java 2 Platform Enterprise Edition, j2EE ).
J2EE is an architecture that uses the Java 2 platform to simplify the development, deployment, and management of enterprise so
The following content is found in Sun's White Paper 1-. Due to my understanding, it is not a translation article (poor English, poor translation ). here, I only focus on the recycling abstraction mechanism, which is not involved in reference counting and specific algorithms.
Hotspot (j2se 5.0, also applies to 6.0 according to the White Paper) uses the so-called generational collection mechanism, which divides objects into young and old (and permanen
I often see that some people have mastered Java, but it may be difficult for them to use Java to build a practical project. Here, based on my own understanding, the author boldly puts forward some standards for mastering java. Of course, for beginners, I can also provide a reference on what needs to be learned. In addition, this standard is limited to j2se, and the content of J2EE has time to be mentioned.
1. Syntax: You must be familiar with the synt
: converts a byte input stream to a character input stream.
Outputstreamwriter: converts byte output into character output streams.
Inputstremreader: belongs to the bytes stream.
How to Use stream to read configuration files
Configuration file:
Write the dynamically changed data in the program into the file, and the program dynamically obtains the content in the file.
This type of file is the configuration file.
INI:
Properties:
XML:
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.