Java Basics-Day 15th

Source: Internet
Author: User
Tags dateformat string format

First, Date class

Construction method [2]

Date--Long Interchange

Date d = new Date ();

Date D1 = new Date ();

D1.gettime ();

D1.settime ();

Second, DateFormat class

Formatting: Date--String

Parsing: String--Date

SimpleDateFormat class [extends DateFormat]

Public final String format (date date):D ate--String

Time format: yyyy mm month DD Day HH:MM:SS HH:mm:ss YYYY/MM/DD HH:mm:ss

YYYY MM month DD Day YYYY-MM-DD HH:MM:SS

Parsing: String--Date

Public Date Parse (String str);//string--Date

Third, Calendar class

Get any calendar field from the calendar, combine as needed

[GregorianCalendar extends Calendar]

public int get (int field): Parameter is Calendar field year MONTH DATE HOUR MINUTE SECOND

MONTH: The range is 0~11 Second: can be judged at output ((Second>9?second: "0" +second));

Example: Calculate the number of days in February for any year "2"

Add () Subtracts the given calendar, plus the specified time

In the development, the definition class: No parameter constructs must give; when giving the parameter, the full parameter is given.

Object array: The address value of the object is stored-keyboard input data

Iv. User Login and Registration

More in line with object-oriented:

A: Determine the number of classes

B: Determine the functionality of each class

C: Maintaining relationships between classes

Classification of classes:

Basic class entity class---Simple description cn.itcast.pojo cn.itcast: Company domain name anti-write

Action class----action on entity classes

Cn.itcast.dao: operator interface

Cn.itcast.dao.impl: specific Operation implementation class

Test class---There is no such package in real development

Subcontracting of the class:

A: by module: cn.itcast.student

Cn.itcast.student.add

Cn.itcast.student.update

Cn.itcast.student.delete

Cn.itcast.student.find

Cn.itcast.teacher

Cn.itcast.teacher.add

cn.itcast.teacher.update^ ^^ ^^

B: By operation points: Cn.itcast.add

Cn.itcast.add.student

Cn.itcast.add.teacher

Cn.itcast.update

cn.itcast.update.student^ ^^

Note: When writing a method, the parameter is more than three, passing the object

Console class--Password display related

Java Basics-Day 15th

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.