Java Course intern Journal (Monday)

Source: Internet
Author: User
Part I: Experimental projects
Item One: Random photo display.
Objective: To understand the generation of random numbers and the display of pictures. Goal:
(1) On the basis of existing code, complete the random (or sequential) display of three pictures of the function.
(2) When guessing accurate, or error, pop-up dialog box to respond.


Item II: Preliminary database. Objective: To understand the steps and methods of Java connection database, as well as the installation and use of MySQL database. Objective: (1) The MySQL database is installed in the computer room. (2) Create data tables
(3) When the guess is correct, success+1 in the datasheet, failure+1 when the error is guessed.
Related courseware: 10th chapter: Database (Network disk download). Please practice database operations, familiar with the Java database Additions and deletions to check operations.


Part II: Job Blog Requirements1. In the Homework blog, use this week and 17 weeks Monday morning time, complete two projects, and the running results, code written to the blog.
2. In the Homework blog, answer the following four questions:
(1) Briefly describe the basic steps of connecting to a database in Java. The corresponding core class and code are respectively. ① load JDBC driver class.forname ("Com.mysql.jdbc.Driver"); ② Establish database connection {String uri= "jdbc:mysql://localhost/test";//test is the library name
Connection con=drivermanager.getconnection (URI, "root", "123");  ③ Create a Statement object Statement stmt = Con.createstatement (); ④ executes the MySQL statement ResultSet executequery (String sqlstring): Executes the SQL statement that queries the database, returns a result set (ResultSet) object ⑤ closes the JDBC object to release the resource rs.cl OSE (); Stmt.close (); Conn.close ();
(2) briefly describe the SQL statement in MySQL that creates a data table. CREATE table < table name >
(3) A brief description of what the core code of the random number between [1,53] is generated in Java.
Package Qiang;

Import Java.util.Random;

@SuppressWarnings ("unused") public
class FA {public
	static void Main (String args[]) {
		long Temp;
		Temp = Math.Round (Math.random () * + 1);

		System.out.println ("" + Temp);
	}



(4) A brief description of what classes are in Java for reading and writing text files. What the core code is, respectively.
Fileinputstream/fileoutputstream



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.