public class HelloWorld{
public static void main(String[] args) {
int score=68;
String mark =(68>60)?("及格"):("不及格");
System.out.println("考试成绩如何:"+mark);
}
}
public static void main(String[] args) {
int score=68;
String mark =(68>60)?("及格"):("不及格");
System.out.println("考试成绩如何:"+mark);
}
}
2015-07-29
int age1=24;
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
2015-07-28
public class HelloWorld{
public static void main(String[] args) {
final String sex1="男";
final String sex2="女";
System.out.println("果儿是"+sex1);
System.out.println("花儿"+sex2);
}
}
public static void main(String[] args) {
final String sex1="男";
final String sex2="女";
System.out.println("果儿是"+sex1);
System.out.println("花儿"+sex2);
}
}
2015-07-28
public class HelloWorld{
public static void main(String[] args) {
double avg1=78.5;
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
public static void main(String[] args) {
double avg1=78.5;
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
2015-07-28
public class HelloWorld{
public static void main(String[] args) {
String city;
city="郑州";
System.out.println("我的家乡在:"+city);
}
}
public static void main(String[] args) {
String city;
city="郑州";
System.out.println("我的家乡在:"+city);
}
}
2015-07-28
for (int i = 10; i>0;i-- ) {
// 内层循环控制每行的*号数
// 内层循环变量的最大值和外层循环变量的值相等
for (int j =1;j<=10-i+1;j++ ) {
System.out.print("*");
System.out.print(" ");
}
// 每打印完一行后进行换行
System.out.println();
}
// 内层循环控制每行的*号数
// 内层循环变量的最大值和外层循环变量的值相等
for (int j =1;j<=10-i+1;j++ ) {
System.out.print("*");
System.out.print(" ");
}
// 每打印完一行后进行换行
System.out.println();
}
2015-07-28
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int count_num=1;
while(count_num%num==count_num)
{
count++;
count_num*=10;
}
System.out.println("它是个"+count+"位的数!");
}
}
public static void main(String[] args){
int num = 999;
int count = 0;
int count_num=1;
while(count_num%num==count_num)
{
count++;
count_num*=10;
}
System.out.println("它是个"+count+"位的数!");
}
}
int sum=age1+age2+age3+age4;
double avg=sum/4;
int minus=age1-age2;
int newAge=--age1;
double avg=sum/4;
int minus=age1-age2;
int newAge=--age1;
2015-07-28
public class HelloWorld{
public static void main(String[] args) {
// System.out.println("Java");
System.out.println("imooc");
/* System.out.println("Oracle");
System.out.println("MySQL");*/
}
}
public static void main(String[] args) {
// System.out.println("Java");
System.out.println("imooc");
/* System.out.println("Oracle");
System.out.println("MySQL");*/
}
}
2015-07-28
public class HelloWorld{
public static void main(String[] args) {
final char SEX='男';
final char $SEX='女';
System.out.println(SEX);
System.out.println($SEX);
}
}
public static void main(String[] args) {
final char SEX='男';
final char $SEX='女';
System.out.println(SEX);
System.out.println($SEX);
}
}
2015-07-28