The first program I did (rookie Java class notes)

Source: Internet
Author: User

Memory: Heap area, stack area, constant area, count area, code area; Data type: Basic data type: shape, float, Boolean can only return the true and False value, character type; reference data type: class, array, basic data type--"directly into the stack area, reference data type--" Put the reference to the stack area, Put content in the heap; Full stack engineer: All the city, the best; array declaration: int [] a = new int [7];  method: Modifier return value type method name (parameter list) {method body ... Uniqueness of the "return" Method: Method name + parameter list (order, number, type);  method overloads: Two same class method names   A different parameter list (order, number, type)   Note that the base data type after the method has been made data-invariant reference data types after the method has changed the data   the tool class has encapsulated some specific methods: Arrayssort array; Sorting method specifies array ascending sort arrayssort.sort (* *); Determines whether two values are equal arrayssort.equals (***==***); finds the position of a number in the array arrayssort.binarysearch (* * *); The method must be sorted after using the replacement string in ***=***.replace ( "* *", "* *"); You can convert a string to a new string array in the middle, separated by constants can be directly compared, because the same address, the comparison of strings to use equals but not the same way, can be written as name1.equals (name2); &nbsp. Length can represent the lengths of an array, or it can represent the length of a string where a string is to be added ();  tests which type of function Charmode (in) {if (in=48 && in=57)//number return 1; if (in=65 && in=90)//Capital Letter return 2;if (in=97 && in+122)//Small Letter return 3;else//other symbol return 4;} The calculation returns how many values function total (num) {modes=0;for (i=0;i4;i++) {if (num&1) modes++;num=1;} return modes;} Convert character to array * * = **.tochararray (); According to the above we can make a test password strength of the applet: Import java.util.*;p ublic classqiangdu{public static void Main (string[] args) {System.out.println ("Please enter your password for you to determine the safety degree");    int a=0,b=0,c=0; Scanner Mima = new Scanner (system.in); Input String z = Mima.next (); The value is paid to Z//length to n char[] L = Z.tochararray ();      Convert a character to an array for (int i=0;i<z.length (); i++) {//To perform a one-to-one cycle if (l[i]>=48 && l[i]<=57) {//digital a=1;      }else if (l[i]>=65 && l[i]<=90) {//lowercase letter b=1;      }else if (l[i]>=97 && l[i]<=122) {//capital letter B=1;      }else{//special symbol c=1; }} System.out.println ("View type 1 represents 0 for non-\ n" +a+ ", The letter" +b+ ", the symbol" +c ");    Display type int sum = a+b+c;      Switch (SUM) {//Password strength case 1:system.out.println ("Safety degree: weak");      Case 2:SYSTEM.OUT.PRINTLN ("Safety degree: Medium");    Case 3:SYSTEM.OUT.PRINTLN ("Safety degree: Strong"); }  }}

The first program I made (a beginner's Java class note)

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.