Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5722a69

Browse files
committed
jshell例子
1 parent 5be3312 commit 5722a69

9 files changed

+218
-0
lines changed
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int x=1
2+
x++
3+
System.out.println(x)
4+
/!
5+
/list
6+
/2
7+
/list
8+
/-2
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
int session = 1
2+
int session = 5
3+
/save jshell_save.jshell
4+
/save -all jshell_save_all.jshell
5+
/save -history jshell_save_history.jshell
6+
/save -start jshell_save_start.jshell
7+
/vars
8+
/reset
9+
/vars
10+
/list
11+
/open jshell_save.jshell
12+
/list
13+
/vars
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/set feedback verbose
2+
int x;
3+
/set feedback silent
4+
int y;
5+
/set feedback concise
6+
int z;
7+
/set feedback normal
8+
int normal;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/set start jshell_save.jshell
2+
/vars
3+
/reset
4+
/vars

‎chapter1/jshell/jshell_save.jshell

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int session = 5;

‎chapter1/jshell/jshell_save_all.jshell

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import java.io.*;
2+
import java.math.*;
3+
import java.net.*;
4+
import java.nio.file.*;
5+
import java.util.*;
6+
import java.util.concurrent.*;
7+
import java.util.function.*;
8+
import java.util.prefs.*;
9+
import java.util.regex.*;
10+
import java.util.stream.*;
11+
int session = 1;
12+
int session = 5;
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/help intro
2+
233 + 666
3+
System.getProperty("java.version")
4+
System.out.println(1ドル)
5+
int add(int x, int y) {
6+
return x + y;
7+
}
8+
add(233, 666)
9+
/methods
10+
/save part1.jshell
11+
/methods
12+
/m
13+
/reset
14+
/open part1.jshell
15+
/m
16+
/list
17+
/save -all part2.jshell
18+
/m
19+
/save -all part2.jshell
20+
/save -history part3.jshell
21+
/save -start part4.jshell
22+
/env
23+
/help env
24+
/env
25+
/env -class-path ~/classes
26+
mkdir classes
27+
ls
28+
/env -class-path ~/jshell/classpath1
29+
/env
30+
/env -class-path ~/jshell/modulepath1
31+
/env
32+
/env -class-path ~/jshell/modulepath1 -module-path ~/jshell/classpath1
33+
/env
34+
/help env
35+
/help set
36+
/set
37+
int add(int a,int b){return a+b;}
38+
int add(int a,int b){return a+b+b;}
39+
add(1,1)
40+
int x=5
41+
int x=6
42+
x
43+
/reset
44+
/help intro
45+
233 + 666
46+
System.getProperty("java.version")
47+
System.out.println(1ドル)
48+
int add(int x, int y) {
49+
return x + y;
50+
}
51+
add(233, 666)
52+
/methods
53+
int x
54+
double y = 2.33
55+
static int z = 1
56+
/vars
57+
/drop x
58+
x
59+
/vars
60+
class People {
61+
private final String name;
62+
public People(final String name) {
63+
this.name = name;
64+
}
65+
public void showName() {
66+
System.out.println(this.name);
67+
}
68+
}
69+
People people = new People("DockerX");
70+
people.showName()
71+
class People {
72+
private final String name;
73+
public People(final String name) {
74+
this.name = name;
75+
}
76+
public String showName() {
77+
System.out.println(this.name);
78+
return this.name;
79+
}
80+
}
81+
people.showName();
82+
People people = new People("Java9");
83+
people.showName().length();
84+
/types
85+
/list/help intro
86+
233 + 666
87+
System.getProperty("java.version")
88+
System.out.println(1ドル)
89+
int add(int x, int y) {
90+
return x + y;
91+
}
92+
add(233, 666)
93+
/methods
94+
int x
95+
double y = 2.33
96+
static int z = 1
97+
/vars
98+
/drop x
99+
x
100+
/vars
101+
class People {
102+
private final String name;
103+
public People(final String name) {
104+
this.name = name;
105+
}
106+
public void showName() {
107+
System.out.println(this.name);
108+
}
109+
}
110+
People people = new People("DockerX");
111+
people.showName()
112+
class People {
113+
private final String name;
114+
public People(final String name) {
115+
this.name = name;
116+
}
117+
public String showName() {
118+
System.out.println(this.name);
119+
return this.name;
120+
}
121+
}
122+
people.showName();
123+
People people = new People("Java9");
124+
people.showName().length();
125+
/types
126+
/reset
127+
Instant.now()
128+
import java.time.*
129+
Instant.now()
130+
/imports
131+
/list
132+
/list 2
133+
/drop 1
134+
Instant.now()
135+
int x=1
136+
x++
137+
/reset
138+
int x=1
139+
x++
140+
System.out.println(x)
141+
System.out.println(x)
142+
/list
143+
x++
144+
/list
145+
System.out.println(x)
146+
/reset
147+
int session = 5
148+
/reset
149+
int session = 1
150+
int session = 5
151+
/reset
152+
int session = 1
153+
int session = 5
154+
/save jshell_save.jshll
155+
/save -all jshell_save.jshll
156+
/save -history jshell_save.jshll
157+
/reset
158+
int session = 1
159+
int session = 5
160+
/save jshell_save.jshll
161+
/save -all jshell_save_all.jshll
162+
/save -history jshell_save_history.jshll
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import java.io.*;
2+
import java.math.*;
3+
import java.net.*;
4+
import java.nio.file.*;
5+
import java.util.*;
6+
import java.util.concurrent.*;
7+
import java.util.function.*;
8+
import java.util.prefs.*;
9+
import java.util.regex.*;
10+
import java.util.stream.*;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /