If you use bash, modify ~/.bash_profile or~/.profile;If you use zsh, modify the ~/.ZSHRCAfter modifying these files, re-open terminal, the configuration will not be lostFirst make sure the JDK is installed:# # Check the present running Javawhich java## check Java versionjava-versionTake zsh as an example:# # Check all the available JDK 2/usr/libexec/java_home-v 3 4 # # Check the top JDK 5/usr/libexec/java_
Java Lesson 1: environment, variables, data types, java Lesson 1
I. java programming considerations1. java case sensitive2. Each statement ends with a semicolon3. Pay attention to indentation for lower-level code4. Braces must appear in pairs.5. punctuation marks should be
How to name Java variablesAs the hotel will give each room a personalized name, the variables in the program also need to use a reasonable name for the management---variable name!It is important to note that the name of the hotel room can be a number, such as "802", can also be interesting names, such as "Peony", "President of the United States", "Water curtain hole", etc., but in the name of the variable m
1. For the self-increment operation ++j and J + +, because the execution order of the addition one is different, there is an intermediate cache variable in Java to store the value of its individual expression, and the result of the self-increment of J is still in the original variable storage area.Because the body is the value of J, and the value of a single expression is a temporary variable value produced in the middle, it is a value that can be dis
JAVA program, basic data type, data type conversion, variables and constants, common operators, java Operators
I. Basic Data Types
Integer type: byte, short, int (commonly used), long (usually used)
Defines a variable int a = 10;
Floating point type (decimal): float, double (commonly used)
Character Type: char (not a string)
Char B = 'A'
Escape Character class:
JAVA Memory Model (synchronization of variables) and java model variable Synchronization
Modifications to variables in a thread may not be immediately visible to other threads, but may never be visible.
In code 1, if a thread calls MyClass. loop (), another thread calls MyClass at a certain time point in the future. se
first knowledge of JavaThe Java file name extension must be. java;Java Cross-platform is a cross-operating system (after Java compilation is completed, A. class file is generated and can be run in the JVM.) The JVM is included in the JDK, only the JDK can be downloaded to achieve cross-platform.Java originated in Sun (
The template language binding variable is a program that actively binds to beetl, and is now implementing the binding by actively making the template language unsolicited request on beetl.Recently done projects to Beetl, because the template needs to use a lot of variables, if directly bound, the system consumes a lot.Generates an idea that when beetl resolves to a variable, fetching the object directly through the
Modifiers in Java are categorized as class modifiers, variable modifiers, and method modifiers.Class modifier:1, Public:public is the public class.2. Package: The default defaults to pack modifiers, this package is visible.3. Abstract: A class that is decorated with an abstract modifier is called an abstract class. A class that contains one or more abstract methods must be declared as an abstract class, and an abstract class cannot be instantiated.4.
How to Set up a Java Development Environment under Mac OS and configure Java environment variables, osjava1. Open the terminal and search in the finder (This MAC) to find the Terminal 2. In cdlouiedeAir :~ Cdlouie $ (cdlouie is my computer user name) and enter sudo vim/etc/profile 3. enter the user name and password of the computer after the password. The passwor
Java programs rely on JDK, just like C # program dependencies. NETFramework the same.
So before developing, you have to install the JDK (Javadevelopkit) in Win7 or Linux, including some Java tools, and the JRE (javaruntimeenvironment) Java Runtime Environment.
System: Windows7
JDK version: jdk1.7
Installation path: C:/j
Cat extends Animal {public static void Testclassmethod () { System.out.println ("The class method" + " In Cat. "); public void Testinstancemethod () { System.out.println ("The instance method" + "in Cat."); } public static void Main (string[] args) { cat mycat = new Cat (); Animal myanimal = mycat; Animal.testclassmethod (); Myanimal.testinstancemethod (); }}The Cat class covers the instance method of animal and hides its class methods. T
JAVA variables, data types, operators, and java Operators
1. What is a variable?A: the representation of a data bucket2. Basic Data TypesInt (integer) double (double Precision) float (single precision) // Add f short (short integer 2 ^ 16)Char (character type) String (String) long (long integer 2 ^ 64) boolean (boolean type)3. Use of VariablesTwo methods1) declar
Java environment variablesProgramImpact
Java_home =/opt/Java/jdk1.6.0 _ 13Classpath =.: $ java_home/lib: $ java_home/JRE/libPath =.: $ path: $ java_home/bin: $ java_home/JRE/bin
The environment variable classpath is closely related to Java program development,When you use javac to compile a Java program, the com
Hide Variables
In a class, if the name of a variable is the same as that of the parent class, even if their types are different, in the subclass, variables with the same name of the parent class cannot be accessed directly through the variable name.However, variables with the same name of the parent class can be accessed through super. Generally, hidden
Original source: http://www.ibm.com/developerworks/cn/java/j-jtp06197.htmlGuidelines for using volatile variablesThe Java™ language contains two intrinsic synchronization mechanisms: synchronous blocks (or methods) and volatile variables. Both of these mechanisms are proposed to achieve the security of code threads. Where volatile
Project development has always been adopted is jdk1.5, there is no problem. These two days, because a member is reflected in the installation of the relevant tools, the development of eclipse can not be opened, prompted the current Java version of 1.4, and the need for 1.5. by typing "java-version" in MS-DOS, the version of Java is indeed 1.4. Look at the
The concept of environmental variables is not unfamiliar, is the operating system environment variables.The system variable is the variable that the Java itself maintains. Acquired by means of System.getproperty.For different operating systems, environment variables can be handled in a number of areas that are not uniform, such as: case-insensitive, and so on.
Configure JDK environment variables in Windows XP:1. Install JDK. You can customize the installation directory and other information during the installation process. For example, select D: \ Java \ jdk1.5.0 _ 08 as the installation directory;
2. After the installation is complete, right-click "my computer" and click "properties ";
3. Select the "advanced" tab and click "environment
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.