Create
a program that will let the user input its name and password, if input name and
password is correct end the program. If Name and password is wrong end the
program.
•Variables in Java have a type.
•The type defines what kinds of values a
variable is allowed to store.
•Integer
Types:
–int:
Most numbers you’ll deal with.
–long:
Big integers; science, finance, computing.
–short:
Small integers. Legacy. Not very useful.
–byte:
Very small integers, useful for generic data.•Floating
Point (Decimal) Types:
–float:
Single-precision decimal numbers
–double:
Double-precision decimal numbers.
•Other
Types:
–String:
Text strings.
–boolean:
True or false.
–char:
Latin Alphanumeric Characters
•Variable names (or identifiers) may be
any length, but must start with:
–A
letter (a – z),
–A
dollar sign ($),
–Or,
an underscore ( _ ).
•Identifiers cannot contain special
operation symbols like +, -, *, /, &, %, ^, etc.
•Certain reserved keywords in the Java
language are illegal.
•For example, “class”, “static”, “int”, etc.
•Java
is a case-sensitive - capitalization matters.
•“Camel
Case”: Start variable names with lower case and capitalize each word: “camelsHaveHumps”.
Data Type
|
Description
|
byte
|
Variables of this kind can have a value from:
-128 to +127 and occupy 8 bits in memory
|
short
|
Variables of this kind can have a value from:
-32768 to +32767 and occupy 16 bits in memory
|
int
|
Variables of this kind can have a value from:
-2147483648 to +2147483647 and occupy 32 bits in memory
|
long
|
Variables of this kind can have a value from:
-9223372036854775808 to +9223372036854775807
and occupy
64 bits in memory
|
No comments:
Post a Comment