Good Java Style:part 2
by Thornton Rose
Introduction
This is the conclusion of a Two-part series on Java coding style. In good Java Style:part 1
, I introduced my case for writing Java code using good habits, explained why we should care about the
What's the difference between throw and throws?
Throw is used to throw exception, in a method,
And throws is used to declare a possible exception, used in the declaration of a class or method.
How do I generate. jar files?
Usage: jar {ctxu}[vfm0m]
1. Access Control in Java
Table 1-1
Visibility/Accessibility
Public
Protected
Package
Private
In the same class
Yes
Yes
Yes
Yes
In the same package
Yes
Yes
Yes
No
In different packages
Yes
No
No
No
In subclasses of the same package
Yes
Yes
Yes
No
In
In the previous article, "Java Learning Java Environment", we learned the basic concept of the Java Runtime platform, in this article, let's look at how to install and configure the Java platform, and begin to write our first Java applet
In a method of Java/scala, a local variable with the same name as a global variable will overwrite the global variable, but when this variable is referenced before the local variable definition in this method, a different implementation is given in
The date format in Excel, such as converting it to a number format in 2009-12-24, becomes 40171, and when used in Java, the reading will be 40171.If you use POI to work with a type of date cell in Excel, you will end up with a numeric type if you
0X00 abstract class & Interface Introduction
Abstract classAbstract abstract modifiers--abstractions are designed to integrate subclasses and not directly implement an objectAll abstract methods in an abstract class are implemented in
Recently we need to do a two-dimensional code generation and embed two-dimensional code in an existing background template. Has not written these aspects of things, suddenly write is really a bit confused, especially for the Java Picture API is not
The façade pattern consists of three roles:
1 façade role (façade): This is the centerpiece of the façade model. It is called by the client role, so it is familiar with the functions of the subsystem. Within it, several functional combinations are
The code is as follows
Copy Code
Import Java.io.File;Import Javax.xml.parsers.DocumentBuilder;Import Javax.xml.parsers.DocumentBuilderFactory;Import org.w3c.dom.Document;Import org.w3c.dom.Element;Import
/*** Robot class:** EXEC function declaration:* Public Process EXEC (String command) throws IOException, parameters and function Description:* Command: A specified system command* Function: Executes the specified string command in a separate process*
Note:Single line comment ://Multi-line comment :/**/Document note :/***/The document notes can be used to Export documents with the Export. The commonly used Javadox labels are as follows:@ Author: specifies the author of the Java program.@ Version:
Every Java application can have its own security manager, which is the main security guard against malicious attacks. The security manager performs runtime checks and access authorization to implement the security policies required by the
I. Concepts of threads and processesThe current operating system is a multi-task operating system. Multithreading is a way to implement multiple tasks.A process is a dynamic execution process of a program. It refers to an application running in the
Java Virtual MachineJava Virtual Machine is a Java Virtual Machine (VM. the concept of VM was first derived from the CPU simulator. It is well known that game machine simulators on PCs use similar technologies as Java VMs. after the java source code
A large number of useful suggestions are provided to help you design low-level programs and provide general instructions for coding:(1) the first letter of the class name should be capitalized. The first letter of the field, method, and object
31. Convert the encapsulated object to the basic data type: obj. XXXValue (); obj is the encapsulated object, and XXX isBasic data type.32. Convert from String to basic data type: obj. parseXXX (String str); obj is the object of the encapsulation
91. Package name: lowercase letters, domain names in reverse order.92. The class in the package must be declared as public. Otherwise, the method that does not belong to this package cannot use it.93. Use a JAR file for easy maintenance and
OverviewPackageClassUseTreeDeprecatedIndexHelpJavaTM 2 PlatformStd. Ed. v1.4.2PREV CLASS NEXT CLASSFRAMES NO FRAMESIf (window = top ){Document. writeln (' All Classes '); }// -->All ClassesSUMMARY: NESTED | FIELD | CONSTR | METHODDETAIL: FIELD |
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