BufferedWriter (new OutputStreamWriter (System.out));5, read a text file, the file according to the specified encoding table UTF-8 storage, save to another file. 1, clear system:Source: InputStream, ReaderPurpose: OutputStream, Writer2, Clear data:Source: Is it plain text? It's Reader .purpose; Is it plain text? It's Writer .3, clear equipment:Source: Hard drive: FileReader.Purpose: Hard disk: FileWriterFileReader fr = new FileReader ("A.txt");FileWriter fw = new FileWriter ("B.txt");4, Add
problem? What can I do if I want to make the assignment right? What is the result? Exercise: Byte B = (byte);*/Public classText { Public Static voidMain (string[] args) {//because the range of byte is:-128 to 127. //and 130 is not within this range, so error. //byte B = 130; //We can use forced type conversions byteB = (byte) 130; //How much is the result?System.out.println (b); }}/*Analysis Process: If we want to know what the result is, we should know how to calculate it. And we
the same variable can is tracked down at a code level. To being able to know if independent variables share the same cache line we need to know the memory layout, or we can get a T Ool to tell us. Intel VTune is such a profiling tool. In this article I'll explain how memory was laid out for Java objects and how we can pad out our cache lines to avoid false Sharing.In multi-processor, multi-threaded scenari
; intn=count; if (N==anotherstring.count) { charv1[]=value;charv2[]= anotherString.value;inti=offset; intj=anotherString.offset; while (n--!=0) {if (v1[i++]!=v2[j++]) returnfalse;} returntrue;}} returnfalse;} 3, String other considerations1), the string has no attribute exposure, the internal property is generally private and final type, such as offset, count, value; 2), the string rewrite the Equals method, then also must rewrite the Hashcode method; 3), the string cannot be inherited because
inheritance.because the interface defines a specification, the interface cannot contain constructors and initialization block definitions. The interface can contain member variables (only static constants), methods (only abstract instance methods, class methods (1.8), or Default methods (1.8)), and internal classes (including internal interfaces, enumerations) are defined.The system automatically adds the public static final modifier to the member variables in the interface.So the definition of
First, this; class variable/class method1.this: Used to differentiate between properties in a constructed method (only used internally)2. Class variable: (access modifier) static data type variable nameAccess method: Class name. Variable name (or object name). Class variable name)3. Class method: (access modifier) static data type variable nameAccess method: Class name. The class method name (or object name). class method Name)Second, encapsulation: access modifiers:Iii. Inheritance: Resolving
Template Method mode for Android source code analysis, android source codeMode definition
Defines the framework of an algorithm in an operation, and delays some steps to the subclass. This allows subclass to redefine certain steps of an algorithm without changing the structure of an algorithm.
Use Cases
1. Multiple subclasses have public methods, and the logic is basically the same.
2. for important and com
in the lock flag waiting pool, and only the lock flag waits for the thread to acquire the lock flag, and notify () does not work if there are no threads in the lock flag waiting pool.Notifyall () removes all the threads waiting for that object from the object waiting pool and puts it in the lock flag waiting pool.Note that these three methods are java.lang.Object methods.5, run and start ()Put the code that needs to be processed into the run () metho
;===============================================================================================================Multi-Table query:
Ways to query Multiple tables:
* Cross Connection:* SELECT * from a B; ---obtained is the Cartesian product of two tables.* Inner Connection: INNER JOIN--inner can be omitted* Explicit Intra-connection: SELECT * from A inner join B on condition;* SELECT * FROM customer C INNER JOIN orders o c.cid = o.cid;* Implicit internal connection: SELECT * from a a
One.Review Operators:Add : ternary operator. Code:/*Three-mesh operators:Ternary operators:Structure:conditions? The result of condition establishment : The result that the condition is not established ;*/Class Demo1{public static void Main (string[] args){int a = 10;int B = 9;int c = b++>=a? a++: B+a;System.out.println (a); 10System.out.println (b); 10System.out.println (c); 20}}two. Control Statements1.1 Sequential structure ( most common ) Feature
1. Key wordsConcept: Words that are given special meaning by Java.Example: Declaring a class keyword: classAccess Rights keyword: publicstatic modifier keyword: staticNo return value type keyword: void2. IdentifiersConcept: A name used to standardize a custom in a programComposition: Alphanumeric underscore $Spec: Cannot start with a numberCannot contain spacesCharacters other than $ cannot appearCannot use keywordsNote: Identifiers in Java are strict
Basic Concepts1. Identifier: consists of letters, underscores, numbers, dollar signs, but cannot start with a number.2, Keywords: 50 keywords, goto Although does not exist, but still is the keyword3, Variable: its naming specification is not necessarily according to the identifier, it can be Chinese and so onData Type1, Java A total of 8 native data types (another is reference type), can be divided into four groups1) Logic Type: Boolean2) Character ty
class is character, the Boolean type encapsulation class is Boolean, They all provide functions that replace the string type with the corresponding base type. (1) Convert string to int type Integer.parseint (string) (2) Convert string to Float type Float.parsefloat (string) (3) Converts a string to a Double type double.parsefouble (string) Instance code:
Package Typeconverttest;public class typeconverttest{public static void Main (s
Java technology improvement, review, and summary (2)
Next reflection:
Array reflection, also see the code comprehension:
int [] a1 = new int[]{1,2,3};int [] a2 = new int[4];int[][] a3 = new int[2][3];String [] a4 = new String[]{"a","b","c"};System.out.println(a1.getClass() == a2.getClass());System.out.println(a1.getClass() == a4.getClass());System.out.println(a1
1. What is the role of private in the encapsulation class?A: The property and behavior in a class can be modified by private to make the modified property and behavior inaccessible.General access to member properties: Assign (set), take a value (get get), so access to private variables can be by providing a corresponding setxxx or GetXXX method。2. What does the this keyword do in Java?A: This represents the ontology of the class that is located, and i
methods that the parent class does not have in the child class. When we use an upward transformation, the definition of a reference to a subclass of a parent class object can use both the powerful function of the subclass object and the commonality of the parent class directly. The advantage of this is that when we are dealing with large projects, we encounter a parent class that inherits multiple subclasses. And inevitably, quite a lot of static methods are used , and the parameters of the st
write this article to review the Java static block, Main method, building blocks, construction methods of the order of execution, directly run the following code can be at a glance, no more said.
/** * Run the Parent class Main method The order of execution of each block scope: * Static block (and only once)-> Main method-> construction method of building bloc
Tomcat's lib. public class Hello extends HttpServlet {private static final long serialversionuid = 1L;
JDBC driver name and database URL static final String jdbc_driver = "Com.mysql.jdbc.Driver";
Static final String Db_url = "Jdbc:mysql://localhost:3306/test";
The user name and password of the database need to be static final String user = "root" according to your own settings;
Static final String PASS = "";
/** * @see httpservlet#httpservlet () */public Hello ()
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.