public class DooBee { public static void main(String[] args) { int x = 1; while(x<10){ System.out.println(x); x=x+1; } if(x==3){ System.out.println("1111"); }
public class Hello {
public static void main(String[] args) {
int x = 1;
while(x<3){
System.out.println(x);
x=x+1;}
if(x==3);{
System.out.println("1111");
}
}
}
不知道这样写行不行
public class DooBee { public static void main(String[] args) { int x = 1; while(x < 10){ System.out.println(x); x=x+1; if(x==3){ System.out.println("1111"); } } } }
牛
package task17;
import javax.swing.JOptionPane;
public class L{
public static void main(String[] args) {
int x=0;
x=Integer.parseInt(JOptionPane.showInputDialog("请输入数字",new Integer(x)));
switch(x){
case 1:System.out.println("1");
break;
case 2:System.out.println("2");
break;
case 3:System.out.println("1111");
break;
case 4:System.out.println("4");
break;
case 5:System.out.println("5");
break;
case 6:System.out.println("6");
break;
case 7:System.out.println("7");
break;
case 8:System.out.println("8");
break;
case 9:System.out.println("9");
break;
case 10:System.out.println("10");
break;
default:System.out.println("你的输入不要超过十");
}
}
}
不知这样可不可以
还有这样
package task17;
public class J {
public static void main(String[] args) {
int x=1;
while(x<=10){
if(x==3){
System.out.println("1111");
}
else
System.out.println(x);
x++;
}
}}
public class DooBee { public static void main(String[] args) { int x = 1; while(x<10){
if(x==3){ System.out.println("1111");
else if(x != 3){
System.out.println(x);} x=x+1; }
class WhileDemo
{
public static void main(String[] args)
{
int x =1 ;
while (x<=10)
{
if (x==3)
{
System.out.println("x="+"1111");
}
else
System.out.println("x="+x);
x++;
}
}
}
貌似大家都是用while,小弟弄个for循环的献丑了,多多指教
class one{
public static void main(String[] args){
for(int i=1;i<=10;){
if(i==3){
System.out.println(1111);
}
else
System.out.println(i);
i=i+1;
}
}
}
public class DooBee {
public static void main(String[] args) {
int x = 1;
while(x<=10){
if(x==3){
System.out.println("1111");}
else {
System.out.println(x); }
x=x+1;
}
}
}
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
String i[]={"1","2","3","4","5","6","7","8","9","10"}; //在内存开辟数组空间
for (int j = 0; j < i.length; j++) { //我们用循环遍历整个数组
if(i[2]=="3"){ //i[2]数组下标为2时元素是"3"
i[2]="1111"; //那么我就把"1111"将"3"覆盖
}
}
System.out.println(Arrays.toString(i)); //循环结束,打印数组
}
}
//这样的程序实现方法很多,希望你采纳,谢谢!
public class Hello {
public static void main(String[] args) {
int x = 1;
while(x<10){
if(x==3){
System.out.println("1111");
}
else{
System.out.println(x);
}
x=x+1;
}
}
}
public class Test {
public static void main(String[] args)
{
for(int i=0;i<10;i++)
{
if(i==3)
System.out.println("1111");
else
System.out.println(i);
}
}
}
public class MyFirstApp {
public static void main(String[] args) {
for(int i = 0 ; i < 10 ; i ++){
if(i == 2){
System.out.println("1111");
}else if(i != 2){
System.out.println(i+1);
}
}
}
}
public calss GoodJob{
public static void main(String[] args){
for(int a =1;a<=10;a++){
if(a!=3){
System.out.println(a);
}else{
System.out.println("1111");
}
}
}
}
public class test
{
public static void main(String[] args)
{
for(int i = 1; i<=10;i++)
{
if(i != 3)
{
System.out.println("i的值为"+i);
}
else
{
System.out.println("i的值为1111");
}
}
}
}
我就用golang写一个吧。
package main
func main() {
for i := 0; i < 10; i++ {
if i == 3 {
println("1111")
} else {
println(i)
}
return
}
for(var i=1;i<=10;i++){
if(i===3){
document.write('i='+i+' 这里要打印1111 <br>');
}else document.write(i+'<br>');
}
for($i=1;$<=10;$i++){ if($i==3){ echo "1111"; } esle{ echo $i } }
public class Hello { public static void main(String[] args) { for (int x=1;x<=10;x++) { if(x==3){ System.out.println(1111); }else { System.out.println(x); } } } }
<?php
for ($i=0; $i < 10; $i++) {
if ($i == 3) {
echo "111";
}
}
?>
java零基础入门学习视频下载 链接:http://pan.baidu.com/s/1pLL4HfH 密码:iuef
java零基础入门学习视频: https://ke.qq.com/course/124850#term_id=100138002
{$ item.file.size/1024/1024|number:2 $} MB