Java basics review, familiar with the development environment-day1

Source: Internet
Author: User
Tags svn client

Exercise 1:

Use the for loop to print 9*9 tables?

 

1*1 = 1

1*2 = 2 2*2 = 4

1*3 = 3 2*3 = 6 3*3 = 9

1*4 = 4 2*4 = 8 3*4 = 12 4*4 = 16

1*5 = 5 2*5 = 10 3*5 = 15 4*5 = 20 5*5 = 25

1*6 = 6 2*6 = 12 3*6 = 18 4*6 = 24 5*6 = 30 6*6 = 36

1*7 = 7 2*7 = 14 3*7 = 21 4*7 = 28 5*7 = 35 6*7 = 42 7*7 = 49

1*8 = 8 2*8 = 16 3*8 = 24 4*8 = 32 5*8 = 40 6*8 = 48 7*8 = 56 8*8 = 64

1*9 = 9 2*9 = 18 3*9 = 27 4*9 = 36 5*9 = 45 6*9 = 54 7*9 = 63 8*9 = 72 9*9 = 81

Exercise 2:

The command line accepts a parameter year and determines whether the year is a leap year?

 

Public class chengfa99 {

/**
* @ Param chengfa99
* @ Author davyzhu
*/
Public static void main (string [] ARGs ){
Int I, j, sum;
For (I = 1; I <= 9; I ++ ){
For (j = 1; j <= I; j ++ ){
Sum = I * J;
System. Out. Print (J + "*" + I + "=" + sum + "");

}
System. Out. println ();
}

}

}

 

 

 

Public class work_02 {

/**
* @ Param work_02
* @ Author davyzhu
*/
Public static void main (string [] ARGs ){
String YY = ARGs [0];
Int year = integer. parseint (yy );
If (Year % 4 = 0 )&&! (Year % 100 = 0) | (Year % 400 = 0 ))
System. Out. println (Year + "�� ");
Else
System. Out. println (Year + "���� ");
}
}

 

Class notes:

1. JDK Installation
(1) After installation is complete, there must be two directories: jdk1.6 _ x JRE.
(2) Configure JDK as follows in system environment variables:
Java_home = C:/program files/Java/jdk00006_x // define a variable named java_home with the value equal to the JDK installation path
Classpath =.; % java_home %/lib/tools. jar; % java_home %/lib/dt. jar; // tell the operating system where the Java Development Library is located
Path = original configuration unchanged; % java_home %/bin; // tell the operating system where the Java development tool is located
(3) Check JDK Configuration
Open the DOS window and enter the Java and javac commands to run normally, indicating that the configuration is correct.

Supplement:
C:/program files/Java/jdk1.6.0 _ 11/RT. jar in the JRE/lib directory, which is all Java class libraries

2. Java code comments
/* Dithertest. Java
*
* Simple description of this class
*--------------
* Modification records for this class
* Record 1
* Modify the test () method from PM to simplify the algorithm used in the method.
*
*/

/**
* Document comments. The content in the comments will be generated in the HTML document, so that we can generate a code-based API.
* Class comment: describes the functions of the entire class.
* @ Author name
*/

Document Note :/***/
Multi-line comment :/**/
Single line comment ://

3. Java tools
Javac compiles *. Java source code and generates *. Class bytecode after compilation.
Java runs *. Class bytecode to generate binary codes that can be executed by the CPU.
Javadoc extracts the document comments added in *. Java source code /***/

4. Java access modifier
All classes under the Public package can be accessed.
By default, all classes in the same package can be accessed.
Protected can be accessed by all classes in the same package.
Private can only be accessed in the same class

Code Writing rules:
Class attributes are generally set to private, and other classes are not allowed to directly access and modify
You can set public get set methods for these attributes to access or modify attribute values.

5. JVM execution bytecode
Classloader --> bytecode verification --> interpretation execution (or JIT execution)

6. tool instructions
SVN client: TortoiseSVN-1.5.4.14259-win32-svn-1.5.3.msi
Chinese package: LanguagePack_1.5.4.14259-win32-zh_CN.msi

Purpose: connect to the svn server and upload or download resources (Code, project, and file)

SVN directory structure
Code: Class DEMO code
DOC: Reference documents or books
Homework: homework or task list after class
301
Myproject_zyq
302

Tools: tools required for development

Related Article

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.