Java - , . Java , Java. , , class.
, , , Hello World. , Java-: , , , , , . Java-.
, Java-:
class HelloWorld { public static void main (String args []) { System. out. println ("Hello World"); } }
, Sun Microsystems Java Developers Kit Java- (http://java.sun.com/products/jdk). JDK 1.
Java , . HelloWorld.java. . , Java javac, :
: \> javac HelloWorld.Java
HelloWorld.class - . , , Java ( java), . , , , .
: > java HelloWorld
, , Java- .
, HelloWorld . Java , , , Java-.
1
class HelloWorld {
class. , . 5. Java , ++.
2
public static void main (String args []) {
, , , Java. , Java . , .
public
, public. , . public , main . 2 private protected, 8.
static
static. , . , static, .
void
, : , int , float - , . , main . void. 4.
main
, main. , Java-, , main. Java- , main. Java- main .
, , , ";" ( ). . , . , , main , .
String args[] args, String. , args. , , . , , String . 9.
System. out. prlntln("Hello World!");
println out. out OutputStream System. 9 13 String OutputStream.
4 main, 5 HelloWorld.
, Java-, . Java , , , , , .
Java , . , , . , HelloWorld , . , ( ) , .
, . : , , , . , , // . :
= 42; // 42 - , ?
, , /* */ .
/*
* ...
* :
* .
*/
, , javadoc, Java- . , , : , (public) , , /** ( ). , */. javadoc , @. :
/** * . , * , * . * @see Java. applet. Applet * author Patrick Naughton * @version 1. 2 */ class CoolApplet extends Applet { /** * : * @param key - . * @param value - key. */ void put (String key, Object value) {
, Java , , . Java 59 (. 2). Java. , , .
2
Java
abstract |
boolean |
break |
byte |
byvalue |
case |
cast |
catch |
char |
class |
const |
continue |
default |
do |
double |
else |
extends |
false |
final |
finally |
float |
for |
future |
generic |
goto |
if |
implements |
import |
inner |
instanceof |
int |
interface |
long |
native |
new |
null |
operator |
outer |
package |
private |
protected |
public |
rest |
return |
short |
static |
super |
switch |
syncronized |
this |
throw |
throws |
transient |
true |
try |
var |
void |
volatile |
while |
, byvalue, cast, const, future, generic, goto, inner, operator, outer, rest, var Java, , Java ( , , Object).
3
Java
clone |
equals |
finalize |
getClass |
hashCode |
notify |
notifyAll |
toString |
wait |
, . , _ () $ (). , , . Java , . , , , Value VALUE .
Java . , , , . 4.
, . , , 1, 2, 3, 42 . , 10 , . , 8 16 . Java . , 09 , 9 0.. 7, . - (0 0). 0.. 15, 10.. 15 F ( f). , , , Oxffff 65535.
int, Java 32- . , , 2 , long. 64- . L, , long. , Ox7ffffffffffffffL 9223372036854775807L , long.
, . , . , , . , 2.0, 3.14159 .6667 , . . , . : 6.02223, 314159-05, 2+100. Java , double. float, F f. double D d. double 64- , float 32-.
true () false (). true false . true Java 1, a false 0. Java boolean .
Java UNICODE. 16- , , , . (' '). ASCII : - 'a', 'z', '@'. , , .
|
|
\ddd |
(ddd) |
\uxxxx |
UNICODE (xxxx) |
\' |
|
\" |
|
\\ |
|
\r |
(carriage return) |
\n |
(line feed, new line) |
\f |
(form feed) |
\t |
(tab) |
\b |
(backspace) |
Java , , (""). Java (Java ), . : Hello World!; "\; \ \"". / , , . Java . , , .
, . . 5, 3. 3.
3. 3. Java
+ |
+= |
- |
-= |
* |
*= |
/ |
/= |
| |
|= |
^ |
^= |
& |
&= |
% |
%= |
> |
>= |
< |
<= |
! |
!= |
++ |
-- |
>> |
>>= |
<< |
<<= |
>>> |
>>>= |
&& |
| | |
== |
= |
~ |
?: |
instanceof |
[ ] |
, Java-, . , .
|
||
( ) |
|
, , , . |
{ } |
|
, , . |
[ ] |
|
. |
; |
|
. |
, |
, for. |
|
. |
, . |
Java-. , . , , , , for, , . .
:
[ = ] [, [ = 7...];
, , byte, short, int, long, char, float, double, boolean, . . . , . , , .
int a, b, ; |
, b, . |
int d = 3, e, f = 5; |
, d f. |
byte z = 22; |
z. |
double pi = 3. 14159; |
( , ). |
char x = 'x'; |
''. |
, , c , 5, 3-4-5.
class Variables { public static void main (String args []) { double a = 3; double b = 4; double c; = Math.sqrt (a* a + b* b); System.out.println ("c = "+ c); } }
: Java , ( , ). , . Java- , 4, .
10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _. |