Java EE Basics (iv)

Source: Internet
Author: User
Tags naming convention

1, Java Language Foundation (circular structure Overview and for statement format and use)
    • A: Classification of cyclic structures
      • For,while,do...while
    • B: Loop structure for statement format:
    • for(初始化表达式;条件表达式;循环后的操作表达式) {    循环体;}
    • C Execution Process:
      • A: Execute initialization statement
      • B: Execute a JUDGMENT condition statement to see if its return value is TRUE or False
        • If true, continue execution
        • If False, the loop is ended
      • C: Execute the loop body statement;
      • D: An action expression after the loop is executed
      • E: Go back to B.
    • D: Case Demo
      • Output 10 times "HelloWorld" in the console
2, Java Language Foundation (loop structure for the practice of the statement to get data)
    • A: Case Demo
      • 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
3, the Java Language Foundation (loop structure for statement practice summation idea)
    • A: Case Demo
      • Requirements: Finding 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
4, Java Language Foundation (looping structure for statement of practice Narcissus)
    • A: Case Demo

      • 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 = 111 + 555 + 333 = 1 + 125 + 27 = 153
5. Java Language Foundation (the statistical idea of the practice of loop structure for statement)
    • A: Case Demo
      • Requirements: Statistics of "narcissus number" total number of
6. The Java Language Foundation (the format and basic use of the loop structure while statement)
    • A: The format of the loop structure while statement:
    • while循环的基本格式:while(判断条件语句) {    循环体语句;}完整格式:初始化语句;while(判断条件语句) {     循环体语句;     控制条件语句;}
    • B: Execution Process:
      • A: Execute initialization statement
      • B: Execute a JUDGMENT condition statement to see if its return value is TRUE or False
        • If true, continue execution
        • If False, the loop is ended
      • 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
7. Java Language Foundation (practice of loop structure while statement)
    • A: Summation thought
      • The sum of 1-100
    • B: Statistical Ideas
      • Count the number of daffodils.
8, the Java Language Foundation (circular structure do...while statement format and basic use)
    • A: The format of the circular structure Do...while statement:
    • do {    循环体语句;}while(判断条件语句);完整格式;初始化语句;do {    循环体语句;    控制条件语句;}while(判断条件语句);
    • B: Execution Process:
      • A: Execute initialization statement
      • B: Execute the loop body statement;
      • C: Execute control condition statement
      • D: Execute a Judgment condition statement to see if its return value is TRUE or False
        • If true, continue execution
        • If False, the loop is ended
      • E: Go back to B.
    • C: Case Demo
      • Requirements: Please output data in the console 1-10
9, the Java Language Foundation (circular structure three kinds of circular statement difference)
    • A: Case Demo
      • The difference between the three circular statements:
      • The Do...while loop executes at least one loop body.
      • 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.
10, the Java Language Foundation (circular structure Notice of the death cycle)
    • A: Must 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 of the simplest dead loop formats
      • while (true) {...}
      • for (;;) {...}
11, Java Language Foundation (loop structure loop nesting output 4 rows 5 columns of stars)
    • A: Case Demo

      • Requirements: Please output a 4-row, 5-column star (*) pattern.
      •     *****    *****    *****    *****注意:    System.out.println("*");和System.out.print("*");的区别
    • B: Conclusion:
      • Outer loop control number of rows, inner loop control number of columns
12, Java Language Foundation (loop structure loop nested output positive triangle)
    • A: Case Demo
    • 需求:请输出下列的形状***************
13. Java Language Foundation (loop structure 99 multiplication table)
    • A: Case Demo
      • Requirements: Output 99 multiplication table on the console.
    • B: Code optimization
    • 注意:‘\x‘ x表示任意,\是转义符号,这种做法叫转移字符。‘\t‘    tab键的位置‘\r‘    回车‘\n‘    换行‘\"‘‘\‘‘
14. Java Language Foundation (Control jump statement break statement)
    • A:break Usage Scenarios
      • Only in Switch and loop
15, Java Language Foundation (Control jump statement continue statement)
    • A:continue Usage Scenarios
      • Only in the loop
16, the Java Language Foundation (Control jump statement label)
    • Label: Mark a loop to control it
    • Label composition rule: is actually a valid identifier
17, Java Language Foundation (Control adjustment statement exercise)
    • A: Exercises
    • for(int x=1; x<=10; x++) {    if(x%3==0) {        //在此处填写代码    }    System.out.println(“Java基础班”);}我想在控制台输出2次:“Java基础班“我想在控制台输出7次:“Java基础班“我想在控制台输出13次:“Java基础班“   
18. Java Language Foundation (Control jump statement return statement)
    • The role of A:return
      • Return
      • In fact, its function is not to end the loop, but to end 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 and continue the next cycle.
19. Java Language Foundation (method overview and format description)
    • A: Why should there be a way
      • Improve Code reusability
    • B: What is a method
      • A block of code that completes a specific function.
    • C: Format of the method
    • 修饰符 返回值类型 方法名(参数类型 参数名1,参数类型 参数名2...) {    方法体语句;    
    • 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.
        • The formal parameter is the method definition that is used to receive the actual parameter.
      • Parameter type: is the data type of the parameter
      • Parameter name: The name of the variable
      • Method Body Statement: Is the code that completes the function.
      • Return: the End method.
      • Return value: Is the result of the function, which is brought to the caller by return.
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
21. Java language Basics (method Considerations)
    • A: Method invocation (with a specific return value)
      • A: Call alone, generally no meaning, so not recommended.
      • B: The output is called, but not good enough. Because we may need to do further work on the results.
      • C: Assignment invocation, recommended scenario.
    • B: Case Demo
      • A: Method does not call do not execute
      • B: Methods and methods are lateral relationships, cannot be nested defined
      • C: When the method is defined, the arguments are separated by commas
      • D: Do not pass the data type at the time of method invocation
      • E: If the method has a definite return value, be sure to have return with a value
22. Java Language Basics (practice of methods)
    • A: Case Demo
      • Requirements: Keyboard input two data, return two number of large values
    • B: Case Demo
      • Requirements: Keyboard input Two data, compare two number is equal
23. Java Language Foundation (the output star of the method and its invocation)
    • A: Case Demo
      • 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 Invocation (Error)
24. Java Language Basics (practice of methods)
    • A: Case Demo
      • Requirements: Data output According to the keyboard input the corresponding multiplication table
25. Java language Basics (Method overloading overview and basic usage)
    • A: Overview of method overloading
      • 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.

      • The 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)
26. Java Language Foundation (method overloading exercises compare data for equality)
    • A: Case Demo
      • Requirement: Compare two data for equality.
      • parameter types are two int type, two double type, and are tested in the Main method

Java EE Basics (iv)

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.