public class HelloWorld{
public static void main(String[] args) {
String love="我爱慕课网";
String love2="www.imooc.com";
System.out.println(love);
System.out.println(love2);
}
}
public static void main(String[] args) {
String love="我爱慕课网";
String love2="www.imooc.com";
System.out.println(love);
System.out.println(love2);
}
}
2014-12-25
for(int i=0;i<hobbys.length;i++){
System.out.println(hobbys[i]);
}
System.out.println(hobbys[i]);
}
2014-12-24
int i;
int n=7;
int a;
for(i=1;i <= n;i++){
for(a=1;a<=i;a++){
System.out.print("*");
}
System.out.println();
其中n控制行数。这样实现比较灵活。
int n=7;
int a;
for(i=1;i <= n;i++){
for(a=1;a<=i;a++){
System.out.print("*");
}
System.out.println();
其中n控制行数。这样实现比较灵活。
2014-12-24
public class HelloWorld {
public static void main(String[] args) {
int i=1;
int sum = 0;
do{
if(i%2 == 0){
sum = sum + i;
}
i++;
}while(i<=50);
System.out.println("50以内的偶数之和为:"+sum);
}
}
public static void main(String[] args) {
int i=1;
int sum = 0;
do{
if(i%2 == 0){
sum = sum + i;
}
i++;
}while(i<=50);
System.out.println("50以内的偶数之和为:"+sum);
}
}
2014-12-24
int i=1;
int sum = 0;
do{
if(i%2 == 0){
sum = sum + i;
}
i++;
}while(i<=50);
System.out.println(sum);
int sum = 0;
do{
if(i%2 == 0){
sum = sum + i;
}
i++;
}while(i<=50);
System.out.println(sum);
2014-12-24