2004-10-17 Java basic learning (variable)

xiaoxiao2021-03-06  101

Several concepts: Scheme: {If it is a variable defined in the scope, disappear after the scope} 1: Java basic variable variable minimum maximum value boolean: false true boilean b = false; char Single character Char c = 'c'; byte -128 127 byte t = 8; short -32768 32767 Short R = 12345; INT -2 * 31 2 * 31 -1 I = 3; long-2 * 63 2 * 63 -1 Long L = 12345678; float float f = (float) 1.0 or f Loat f = 1.0f; double double d = 123.23string (String is a class, the first letter of the class is big) String s = new string ("abcdefgh"); array: Define 1D: int A [] = New int [3]; two-dimensional: int a [] [] = new int [2] [3]; assignment a [0] = 1; A [0] [0] = 2; length first dimension length: A.Length; the length of the second dimension: a [0] .length; Direct assignment when defined: string names [] = {"Cheng", "zhang", "li"); equivalent to: string names [];

转载请注明原文地址:https://www.9cbs.com/read-105351.html

New Post(0)