How to use Java enum

Just get started, the notes are clear.Writing enumeration Classes/*** You can use an interface or class to wrap an enumeration element so that it can call the portal uniformly*/ Public InterfaceTESTENUMINTFC {/*** Create an enumeration object*/

Java-runnable Lock to realize multi-threading problem of producer and consumer

Case:There is a commodity sales organization, only one producer, two consumers, please use a multi-threaded approach to this case implementation.//inventory function, which holds the information of the stock Storage.java Public classStorage

Java Basics-Class loader

to understand the class loader, first understand the loadI. Loading of classes (overview of loading classes)When a program wants to use a class, if the class has not yet been loaded into memory, the system initializes the class by loading,

Java Fundamentals Summary (i)

three major featuresPackage  The so-called encapsulation, that is, to encapsulate objective things into abstract classes, and classes can be their own data and methods only let the trusted class or object operation, to the untrusted information

Use of "Java" file: Writes a string out to a local file, the reason for size 0kb

Implementation method:Temporarily write a method that writes the string out to a local file , which can be supplemented in more ways later: Public Static voidMain (string[] args) {/*** ============== to prepare some

Java gets the current server IP

Package Hope.ipaddress.demo;import Java.net.inetaddress;import Java.net.networkinterface;import Java.net.socketexception;import java.util.enumeration;/** * Get current server IP * @author HP * */public class Ipdemo {/** * @param args */public

Usage Scenarios for Java set

The 2.Set Usage Scenarios API describes: The Java.util.Set interface, like the Java.util.List interface, inherits from the collection interface, and It is basically consistent with the methods in the collection interface. There is no functional

Java RESTful response Universal class

import Java.util.hashmap;import java.util.Map; Public classResponseData {Privatefinal String message; PrivateFinalintCode; PrivateFinal map data =NewHashmap(); PublicString getMessage () {returnmessage; } Public intGetCode () {returnCode; }

Java multithreading improves three: thread-scoped shared variables &threadlocal

What we are learning today is how to achieve the sharing of variable data within the scope of the thread itself, and the various threads are independent from each other, and each one is maintained, that is, what we call the Threadlocal

Article about the important components of a Java virtual machine

JVM is one of the important components of the Java platform, because it involves too many points of knowledge, so from the following aspects of the JVM for a shallow introduction, if you need to understand deeply, it is recommended to learn the

Java multi-thread reentrantlock and condition

Reference Link: 8288251Reentrantlock Class 1.1 What is the lock framework in Reentrantlock Java.util.concurrent.lock is an abstraction of locking, which allows the implementation of a lock to be implemented as a Java class, rather than as a language

Java abstract classes and interfaces

Interface is a higher level of abstraction than an abstract class, and all methods in an interface are abstract methods without any code for implementation.1. The method of interface can only be public abstract. (public abstract can be omitted, can

Java IO Stream folder tool package Fileutil

http://www.verejava.com/?id=17160035681948public class Test2 {public static void main (string[] args) {Fileutil.createdir ("dir3"); Fileutil.createdirs ("Dir4/test"); Fileutil.renamedir ("Dir4/test", "dir4/newtest");

java keyword (vi)--super

In the Java keyword (v)--this We say that the This keyword is a reference to the current object. The Super keyword in Java is a reference to an object that represents the parent class.   We analyze the phrase "reference to the parent class object",

Reflection in Java

Three kinds of mechanisms for class loading 1, by GetClassPeople p =new People();Class c = p.getClass();2, People.classClass c1=People.class;3, Class.forName ("Tianpo.com.demo.People");Class c2=Class.forName("tianpo.com.demo.People");Object

The difference between wait and sleep in Java (multithreaded programming)

Sleep is a method in thread, and wait is a method in object.Sleep is a thread that goes into hibernation, waits for a period of time, enters the operational state, waits for the CPU to allocate resources and run. At the same time sleep process, it

Java Common class Library Timer TimerTask

http://www.verejava.com/?id=17159702655333import java.text.SimpleDateFormat;import java.util.Date;import java.util.Timer;import java.util.TimerTask;public class Test1 { private Timer timer; public Test1(){ timer=new Timer(); //每隔

Summary of reasons why Java transactions do not roll back

1, first to check the data engine, InnoDB support transactions, MyISAM does not support transactions2. The default spring transaction is rolled back only when an uncaught runtimeexcetpion occurs.Spring AOP Exception Trapping principle: The method

Java Chinese characters are converted to binary encoding according to the specified character set and the binary encoding is converted to the corresponding Chinese character method

Public Static voidMain (String [] args)throwsunsupportedencodingexception {intval = 5; System.out.println (Integer.tobinarystring (7)); System.out.println (Integer.tobinarystring (7>>1)); System.out.println (0b111); System.out.println (

Chinese code conversion in JAVA/JS

One, Java, using UTF-8 to encode and use UTF-8 UrlEncode encoding results are differentUTF-8 "Junshan":& #x541B;& #x5C71;Utf-8/urlencode "Junshan":%e5%90%9b%e5%b1%b1String s = "Junshan"; = Urlencoder.encode (S, "UTF-8"); //

Total Pages: 6206 1 .... 1891 1892 1893 1894 1895 .... 6206 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.