Advanced

Attempt to reproduce Java Game sample

Story: Practice coding in Java by writing a gameTotal Replies: 0
Author Content
dba477

Dec 16, 2020
2:48 AM EST
Original compilation is

javac src/Guess.java -d com/example/guess

[boris@sever33fedora JAVAGAME]$ javac src/Guess.java -d .

[boris@sever33fedora JAVAGAME]$ ls com/example/guess

Main.class

[boris@sever33fedora JAVAGAME]$ jar cfme Guess.jar Manifest.txt com.example.guess.Main com/example/guess/Main.class

[boris@sever33fedora JAVAGAME]$ ls -l

total 8

drwxrwxr-x. 3 boris boris 21 Dec 16 10:33 com

-rw-rw-r--. 1 boris boris 1426 Dec 16 10:45 Guess.jar

-rw-rw-r--. 1 boris boris 22 Dec 16 10:01 Manifest.txt

drwxrwxr-x. 2 boris boris 24 Dec 16 10:22 src

[boris@sever33fedora JAVAGAME]$ jar tvf Guess.jar

0 Wed Dec 16 10:45:16 MSK 2020 META-INF/

99 Wed Dec 16 10:45:16 MSK 2020 META-INF/MANIFEST.MF

1572 Wed Dec 16 10:43:40 MSK 2020 com/example/guess/Main.class

[boris@sever33fedora JAVAGAME]$ java -jar Guess.jar

number is 49

Guess a number between 1 and 100

48

Too low

Guess a number between 1 and 100

50

Too high

Guess a number between 1 and 100

49

That's right!


Post a reply to this thread:

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post