class
WhileDemo
{
public
static
void
main(String[] args)
{
int
x =
1
;
while
(x<=
10
)
{
System.out.println(
"x="
+x);
x++;
//获取10以内的基数
}
}
}
-----------------------------------------------------------
class
DoWhileDemo
{
public
static
void
main(String[] args)
{
int
x =
3
;
do
{
System.out.println(
"x="
+x);
x++;
}
while
(x<
5
);
}
}