public class HelloWorld{
public static void main(String[] args) {
String city="河南郑州";
System.out.println("我的家乡在:"+city);
}
}
public static void main(String[] args) {
String city="河南郑州";
System.out.println("我的家乡在:"+city);
}
}
2015-06-06
String name="爱慕课";
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
2015-06-06
public class HelloWorld{
public static void main(String[] args) {
String hobby="我爱慕课网";
System.out.println(hobby);
hobby="www.imooc.com";
System.out.println(hobby);
}
}
终于弄出来了!
public static void main(String[] args) {
String hobby="我爱慕课网";
System.out.println(hobby);
hobby="www.imooc.com";
System.out.println(hobby);
}
}
终于弄出来了!
2015-06-06
public class HelloWorld{
public static void main(String[] args) {
int a=12;
int b=24;
int sum=a+b;
System.out.println("两数之和为:"+sum);
System.out.println("\n");
}
}
public static void main(String[] args) {
int a=12;
int b=24;
int sum=a+b;
System.out.println("两数之和为:"+sum);
System.out.println("\n");
}
}
2015-06-06
import java.util.Scanner;
public class q2{
public static void main(String[] args){
Scanner i=new Scanner(System.in);
int count=0;
System.out.println("请输入一个数:");
int num=i.nextInt();
for(int e=1;e<=num;count++){
e=e*10;
}System.out.println("它是一个"+count+"位数");
}
}
public class q2{
public static void main(String[] args){
Scanner i=new Scanner(System.in);
int count=0;
System.out.println("请输入一个数:");
int num=i.nextInt();
for(int e=1;e<=num;count++){
e=e*10;
}System.out.println("它是一个"+count+"位数");
}
}
不知道有没有人可以改成等腰三角形
package HelloWord;
public class java {
public static void main(String[] args) {
for(int i=1;i<=5;i++){
for(int j=1;j<=2*i-1;j++){
System.out.print('*');
}
System.out.println(' ');
}
}}
package HelloWord;
public class java {
public static void main(String[] args) {
for(int i=1;i<=5;i++){
for(int j=1;j<=2*i-1;j++){
System.out.print('*');
}
System.out.println(' ');
}
}}
2015-06-06
靠,,,懂了。原来我搞错了
public class q2{
public static void main(String[] args){
for(int i=1;i<=3;i++){
for(int j=0;j<i;j++){
System.out.print("*"+i);
}System.out.println();
}
}
}
public class q2{
public static void main(String[] args){
for(int i=1;i<=3;i++){
for(int j=0;j<i;j++){
System.out.print("*"+i);
}System.out.println();
}
}
}
2015-06-06
按给出的写出来的根本不是直角三角形!是正方形坑啊!这也对?
public class q2{
public static void main(String[] args){
for(int i=1;i<=3;i++){
for(int j=1;j<=4;j++){
System.out.print("*"+i);
}System.out.println();
}
}
}
public class q2{
public static void main(String[] args){
for(int i=1;i<=3;i++){
for(int j=1;j<=4;j++){
System.out.print("*"+i);
}System.out.println();
}
}
}
2015-06-06
package HelloWord;
public class java {
public static void main(String[] args) {
int sum=0,i=0;
do{
if(i%2==0)
sum=sum+i;
i++;
}while(i<=50);
System.out.println("sum="+sum);
}
}
public class java {
public static void main(String[] args) {
int sum=0,i=0;
do{
if(i%2==0)
sum=sum+i;
i++;
}while(i<=50);
System.out.println("sum="+sum);
}
}
2015-06-06