Java Foundation Work4

Source: Internet
Author: User

# # #04.01_java Language Basics (circular structure overview and for statement formats and their use)
* A: Classification of cyclic structures
* For,while,do...while
* B: Loop structure for statement format:
*
For (initialize an expression; a conditional expression; an action expression after a loop) {
Circulation body;
}
* C Execution Process:
* A: Execution of initialization statements
* B: Execute a JUDGMENT condition statement to see if its return value is TRUE or False
* If true, continue execution
* If False, end loop
* C: Execute the loop body statement;
* d: Operation expression after loop execution
* E: Go back to B.
* D: Case Demo
* Output 10 times "HelloWorld" on the console

# # #04.02_java Language Basics (the practice of looping structures for statements get data)
* A: Case Presentation
* Requirements: Please output data in the console 1-10
* Requirements: Please output data in the console 10-1
* B: Precautions
* A: Determines whether a conditional statement is a Boolean type, either simple or complex.
* B: Loop body statement If it is a statement, the curly braces can be omitted, and in the case of multiple statements, the curly braces cannot be omitted. Never omit the suggestion.
* C: Generally speaking: there is no semicolon on the left curly brace, there is no left brace for the semicolon

# # #04.03_java Language Basics (the practice of the loop structure for statement)
* A: Case Presentation
* Requirements: Find out the sum of data between 1-10
* B: Student Practice
* Requirements: Find the number of even numbers between 1-100 and
* Requirements: Find out between 1-100 odd and

# # #04.04_java Language Basics (cyclic structure for statement of practice Narcissus)
* A: Case Presentation
* Requirements: Output All "daffodils" on the console

* The so-called Narcissus number refers to a three-digit number whose numbers are cubic and equal to the number itself.
* Example: 153 is a number of daffodils.
* 153 = 1*1*1 + 5*5*5 + 3*3*3 = 1 + 125 + 27 = 153

# # #04.05_java Language Basics (the statistical idea of the practice of looping structures for statements)
* A: Case Presentation
* Demand: Statistics "Narcissus number" total number of

# # #04.06_java Language Foundation (the format and basic use of the loop structure while statement)
* A: The format of the loop structure while statement:
*
The basic format of the while loop:
while (judging condition statement) {
loop body statement;
}

Full format:

initialization statements;
while (judging condition statement) {
loop body statement;
Control condition statement;
}
* B: Execution Process:
* A: Execution of initialization statements
* B: Execute a JUDGMENT condition statement to see if its return value is TRUE or False
* If true, continue execution
* If False, end loop
* C: Execute the loop body statement;
* d: Execute control condition statement
* E: Go back to B.
* C: Case Demo
* Requirements: Please output data in the console 1-10

# # #04.07_java Language Foundation (practice of loop structure while statement)
* A: Summation thought
* For the sum of 1-100
* B: Statistical ideas
* Count the number of daffodils.

# # #04.08_java Language Basics (format and basic use of circular structure do...while statements)
* A: The format of the circular structure Do...while statement:
*
do {
loop body statement;
}while (Judgment condition statement);

Full format;
initialization statements;
do {
loop body statement;
Control condition statement;
}while (Judgment condition statement);
* B: Execution Process:
* A: Execution of initialization statements
* B: Execute the loop body statement;
* C: Execute control condition statement
* D: Execute judgment condition statement to see if its return value is TRUE or False
* If true, continue execution
* If False, end loop
* E: Go back to B.
* C: Case Demo
* Requirements: Please output data in the console 1-10

# # #04.09_java Language Foundation (the difference between three circular statements in a looping structure)
* A: Case Presentation
* The difference between three types of circular statements:
* The Do...while cycle performs at least one loop body.
* and the For,while cycle must first determine whether the condition is true, and then decide whether to execute the Loop body statement.
* B: Case Demo
* The difference between A for loop and a while loop:
* A: If you want to continue using the variable that controls the condition after the loop is over, use the while loop, otherwise use the For loop. I don't know who to use for loop. Because variables disappear early from memory, you can improve the efficiency of memory usage.

# # #04.10_java Language Basics (cyclic structure of the dead loop of considerations)
* A: Be sure to pay attention to control the condition statement control the problem of the variable, do not lose, otherwise it is easy to die cycle.
* B: Two simplest dead loop formats
* while (true) {...}
* for (;;) {...}

# # #04.11_java Language Foundation (loop structure loop nesting output 4 rows 5 columns of stars)
* A: Case Presentation
* Requirements: Please output a 4-row, 5-column star (*) pattern.
*

*****
*****
*****
*****

Attention:
System.out.println ("*"); and System.out.print ("*"); the difference
* B: Conclusion:
* Outer loop control number of rows, inner loop control number of columns

# # #04.12_java Language Foundation (loop structure loop nested output positive triangles)
* A: Case Presentation
*
Requirements: Please output the following shapes
*
**
***
****
*****

# # #04.13_java Language Basics (Loop structure 99 multiplication table)
* A: Case Presentation
* Requirements: Output 99 multiplication table on the console.
* B: Code optimization
*
Attention:
' \x ' x denotes arbitrary, \ is an escape symbol, which is called a transfer character.

The position of ' \ t ' TAB key
' \ r ' carriage return
' \ n ' newline
‘\"‘
‘\‘‘


# # #04.14_java Language Foundation (Control jump statement break statement)
* A:break Usage Scenarios
* Only in Switch and loop

# # #04.15_java language Base (Control jump statement continue statement)
* A:continue Usage Scenarios
* Only in the loop

# # #04.16_java language Base (Control jump statement designator)
* Label: Mark a loop to control it
* Label composition rules: is actually a valid identifier

# # #04.17_java Language Basics (Control adjustment statement exercises)
* A: Exercises
*
for (int x=1; x<=10; x + +) {
if (x%3==0) {
Fill in the code here
}
System.out.println ("Java Basic class");
}

I want to output 2 times in the console: "Java Basic class"
I want to output 7 times in the console: "Java Basic class"
I want to output 13 times in the console: "Java Basic class"


# # #04.18_java Language Foundation (Control jump statement return statement)
* The role of A:return
* Return
* In fact, it does not end the loop, but the end of the method.
* B: Case Demo
* What is the difference between return and break and continue?
* Return is the End method
* Break is jumping out of the loop
* Continue is to terminate this cycle continue the next cycle


# # #04.19_java Language Basics (Method overview and format description)
* A: Why should there be a way
* Improve the reusability of code
* B: What is a method
* A block of code that completes a specific function.
* C: Format of the method
*
Modifier returns a value type method name (parameter type argument name 1, argument type parameter Name 2 ...) {
Method body Statement;
return value;
}
* D: Format Description of the method
* Modifier: Use public static now. We'll explain the other modifiers in more detail later.
* Return value type: is the data type of the functional result.
* Method Name: Conforms to the naming convention. Convenient for our call.
Parameters
* Actual parameters: is actually involved in the operation.
* Formal parameters; It is the method definition that is used to receive the actual parameters.
* Parameter type: is the data type of the parameter
* Parameter name: Name of variable
* Method Body Statement: Is the code to complete the function.
* Return: The End method.
* Return value: Is the result of the function, which is brought to the caller by return.

# # #04.20_java Language Foundation (method summation case and its invocation)
* A: How to write a method
* 1, explicit return value type
* 2, clear parameter list
* B: Case Demo
* Requirements: Two cases of data
* C: Method invocation Plot

# # #04.21_java Language Basics (Method Considerations)
* A: Method invocation (with a specific return value)
* A: Call alone, generally no meaning, so not recommended.
* B: Output call, but not good enough. Because we may need to do further work on the results.
* C: Assignment call, recommended scheme.
* B: Case Demo
* A: Method does not call do not execute
* B: Method and method is a peer relationship, cannot be nested definition
* C: When the method is defined, the arguments are separated by commas
* D: Do not pass the data type when the method is called
* E: If the method has a definite return value, be sure to have return with a value

# # #04.22_java Language Basics (practice of methods)
* A: Case Presentation
* Requirements: Keyboard input two data, return two number of large values
* B: Case Demo
* Requirements: Keyboard input Two data, compare two number is equal


# # #04.23_java Language Basics (method output star and its invocation)
* A: Case Presentation
* Requirements: Based on the number of rows and columns entered by the keyboard, the output star in the console
* B: Method invocation: (no return value, void)
* Called separately
* Output Call (Error)
* Assignment Call (Error)

# # #04.24_java Language Basics (practice of methods)
* A: Case Presentation
* Requirements: According to the keyboard input data output the corresponding multiplication table

# # #04.25_java Language Basics (Method overloading overview and basic usage)
* A: Method Overloading Overview
* Summation case
* 2 integers
* 3 integers
* 4 integers
* B: Method overloading:
* In the same class, the method name is the same, and the parameter list is different. Is independent of the return value type.

* parameter list is different:
* A: Different number of parameters
* B: Different parameter types
* C: The order of the parameters is different (overloaded, but not in development)


# # #04.26_java Language Basics (method overloading exercises compare data for equality)
* A: Case Presentation
* Requirement: Compare two data for equality.
* parameter types are two int type, two double type, and are tested in the Main method

# # #04.27_DAY04 Summary
Summarize today's knowledge points once again.

Java Foundation Work4

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.