JAVA learning lesson 30th (Common Object API)-String class: Class Method exercises
Intern Method
Public class Main {public static void main (String [] args) {String str1 = new String ("asd"); String str2 = str1.intern ();/* The String constant pool has, returns the string. If no string is returned, the System creates
Preface in either language, we always use regular expressions to find and replace strings. Not in Java, I once wrote a Web page---regular expression online testing. At that time, I had not started to learn Java, do not know Java support regular expression, so my first solution is to find ways to transfer data to the background, and then use the shell script regul
Original address: http://blog.sina.com.cn/s/blog_7a27a9bf0100s887.html
Sometimes you need to find a certain type of file in your program, such as the need to find all files that have a. java suffix name under the E:\data\file_selector_test directory. In fact, this function can also be implemented, very simple, only need to traverse the directory of all the files, to determine whether the end of the file name string is ".
This article introduces the use of the random class of Java common classes, the following is the actual case, no additional text explanation, need to explain I have written in the code comments.
Import Java.util.random;public class Random1 {public static void main (string[] args) {//Two constructors of Random R1
Package Huang.de.wei;import Java.lang.annotation.annotation;import Java.lang.reflect.constructor;import Java.lang.reflect.Method, @SuppressWarnings (value= "Unchecked") @Deprecatedpublic class Classtest {// The private constructor for this class is defined privately classtes
I recently read Java Concurrent in Practice (java Concurrent programming Practice) and found that I have a superficial understanding of java threads, locks, and other mechanisms, and I have not learned fully enough. I plan to use this book to comprehensively learn about the concurrent development of JDK and some thread-related theoretical knowledge, and fill in m
Recently learned the following Java class loading related knowledge. And then see that there's an interview on the InternetCan you write a class called Java.lang.System?Answers available online: usually not, but alternative approaches can be taken to meet this requirement. The so-called alternative method refers to writing a
? Copyright NOTICE: This article is the original blogger article, reproduced please indicate the sourceRecently, colleagues have encountered a large number of data import problems, so also concerned about. There are two main problems with large-scale data import: memory overflow and slow import rate .Memory Overflow : All of the data in the file is taken out of t
Introduced
Jakarta POI is a set of Java APIs for accessing Microsoft-formatted documents. Jakarta POI has a number of components, including HSSF for manipulating Excel format files and HWPF for manipulating word, where only the HSSF that are currently used to manipulate Excel are relatively mature in a variety of components. Official Homepage Http://poi.apache.org/index.html,API Documentation http://poi.apache.org/apidocs/index.html
Realize
A compl
Common Java class libraries-Observer design patterns (Observable class Observer Interface) and observableobserver
Link: http://www.2cto.com/kf/201310/253013.html
To implement the Observer mode, you must rely on the Observable class and Observer interface provided in the java
open source community. Eclipse is built on the basis of OSGi technology.2. Each module (bundle) in OSGi contains Java packages and classes. A module can declare Java packages and classes (via Import-package) of other modules that it relies on to import (imports), or export its own packages and classes for use by other
http://www.verejava.com/?id=16993074079095/** Knowledge Points: Date dates class */import Java.util.date;import java.text.simpledateformat;public class testdate{public static void Main (string[] args) {//Get system Current date date=new date (); SYSTEM.OUT.PRINTLN (date); Obtained year Syst
ObjectiveArray of tool classes Java.util.ArraysSince there is no way for us to invoke the array object itself, the API provides a tool class arrays for us to use, allowing you to perform some basic operations on the data object.I. Arrays class overview 1.1, Introduction of arrays ClassThis is the class in the Java.util package, which we would like to use in our c
. Import PackageTo import a package using the Import keyword, the syntax is as follows:Import com.lzw.*; Specifies that all classes in the COM.LZW package are available in the programImport Com.lzw.Math//Specifies that the Math class in the COM.LZW package can be used in the
To implement the Observer mode, you must rely on the Observable class and Observer interface provided in the java. util package.
Import java. util. *; class House extends Observable {// indicates that the House can be viewed as private float price; // price public House (flo
Java comes with Data encryption class MessageDigest (MD5 or SHA encryption)
Description
In the website, in order to protect the website member's user name and the password and so on privacy information, therefore we in the user registers the direct MD5 way or other way encrypts, even if is the database administrator also cannot view this member's password and so on information, View the password effect in
To facilitate the management of numerous classes in large software systems, solve the problem of class naming conflicts, the Java ingestion Package mechanism, which provides namespaces for classes of multiple classes.The package acts as the first statement in the Java source file, indicating the packages in which the classes defined in the file are located. (if d
capacity.Returns an array using the toarray () of arraylist.Arrays. aslist () returns a list.Iterator provides a common way to access elements in a set.Shortlist:A two-way cyclic list is implemented.Use consumer list to implement stack, queue, and double-ended queue ).
The stack test code based on consumer list is as follows:
// Stack test Import Java based on consumer list. util. *;
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.