请问怎样在Eclipse中编写一个输出“I Love Internet”的 Java Application程序。 5
6个回答
展开全部
且很烦。
5分一题估计都没人做。
只是劝你以后别贴那么大版东西出来啊,
浪费你的分也就罢了,还浪费大家时间
package baidu.question;
import java.io.*;
/**
*
*
* @author Administrator
*
*/
public class Test5 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入一个整数:");
try {
String value = br.readLine();
while (!isInteger(value)) {
System.out.println("你输入的不是整数,请重新输入:");
value = br.readLine();
}
System.out.println("你输入的整数 = " + value);
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
}
package baidu.question;
public class Test6 {
public static void main(String[] args) {
int n = 30;
float num = 1;
for(int i = 1; i <= n; i ++) {
num *= i;
}
System.out.println(n + "! = " + num);
}
}
package baidu.question;
public class Test7 {
public static void main(String[] args) {
for (int i = 1; i < 100; i++) {
if(i % 2 != 0) {
System.out.println(i);
}
}
}
}
package baidu.question;
public class Test8 {
public static void main(String[] args) {
System.out.println(new Employee("007", "周星驰", 100, false, "110", 0.5f));
}
}
class Employee {
String id;
String name;
int age;
boolean sex; // 型,代表性别(其中:true表示男,false表示女)
String phone; // 代表联系电话
float salary; // 代表员工薪水
public Employee(String id, String name, int age, boolean sex, String phone,
float salary) {
this.id = id;
this.name = name;
this.age = age;
this.sex = sex;
this.phone = phone;
this.salary = salary;
}
public String toString() {
return name + ":" + phone;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
}
package baidu.question;
public class Test9 {
public static void main(String[] args) {
int[] a=;
for(int i = 0; i < a.length; i ++) {
System.out.print(a[i] + " ");
}
System.out.println();
a = maxToMin(a);
for(int i = 0; i < a.length; i ++) {
System.out.print(a[i] + " ");
}
}
public static int[] maxToMin(int[] a) {
for(int i = 0; i < a.length; i ++) {
for(int j = i + 1; j < a.length; j ++) {
if(a[i] < a[j]) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
return a;
}
}
package baidu.question;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test15 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入n:");
String value;
try {
value = br.readLine();
while (!isInteger(value)) {
System.out.println("输入的不是整数,请重新输入:");
value = br.readLine();
}
int n = Integer.parseInt(value);
float sum = 0;
for (int i = 1; i <= n; i++) {
sum += (float)1 / count(i);
}
System.out.println(n + "项结果为:" + sum);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static int count(int n) {
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += i;
}
return sum;
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
}
package baidu.question;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test16 {
static int[] b;
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入任意个数字,中间用','隔开,(如1,2,3):");
try {
String value = br.readLine();
while (!checkError(value)) {
System.out.println("输入格式错误,请重新输入:");
value = br.readLine();
}
System.out.println();
System.out.println("排列前:");
for (int i = 0; i < b.length; i++) {
System.out.print(b[i] + ",");
}
System.out.println();
b = maxToMin(b);
System.out.println("排列后:");
for (int i = 0; i < b.length; i++) {
System.out.print(b[i] + ",");
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean checkError(String value) {
if (value == null || value.length() == 0) {
return false;
}
String[] a = value.split(",");
b = new int[a.length];
for (int i = 0; i < a.length; i++) {
if (!isInteger(a[i])) {
return false;
} else {
b[i] = Integer.parseInt(a[i]);
}
}
return true;
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
public static int[] maxToMin(int[] a) {
for (int i = 0; i < a.length; i++) {
for (int j = i + 1; j < a.length; j++) {
if (a[i] < a[j]) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
return a;
}
}
5分一题估计都没人做。
只是劝你以后别贴那么大版东西出来啊,
浪费你的分也就罢了,还浪费大家时间
package baidu.question;
import java.io.*;
/**
*
*
* @author Administrator
*
*/
public class Test5 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入一个整数:");
try {
String value = br.readLine();
while (!isInteger(value)) {
System.out.println("你输入的不是整数,请重新输入:");
value = br.readLine();
}
System.out.println("你输入的整数 = " + value);
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
}
package baidu.question;
public class Test6 {
public static void main(String[] args) {
int n = 30;
float num = 1;
for(int i = 1; i <= n; i ++) {
num *= i;
}
System.out.println(n + "! = " + num);
}
}
package baidu.question;
public class Test7 {
public static void main(String[] args) {
for (int i = 1; i < 100; i++) {
if(i % 2 != 0) {
System.out.println(i);
}
}
}
}
package baidu.question;
public class Test8 {
public static void main(String[] args) {
System.out.println(new Employee("007", "周星驰", 100, false, "110", 0.5f));
}
}
class Employee {
String id;
String name;
int age;
boolean sex; // 型,代表性别(其中:true表示男,false表示女)
String phone; // 代表联系电话
float salary; // 代表员工薪水
public Employee(String id, String name, int age, boolean sex, String phone,
float salary) {
this.id = id;
this.name = name;
this.age = age;
this.sex = sex;
this.phone = phone;
this.salary = salary;
}
public String toString() {
return name + ":" + phone;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
}
package baidu.question;
public class Test9 {
public static void main(String[] args) {
int[] a=;
for(int i = 0; i < a.length; i ++) {
System.out.print(a[i] + " ");
}
System.out.println();
a = maxToMin(a);
for(int i = 0; i < a.length; i ++) {
System.out.print(a[i] + " ");
}
}
public static int[] maxToMin(int[] a) {
for(int i = 0; i < a.length; i ++) {
for(int j = i + 1; j < a.length; j ++) {
if(a[i] < a[j]) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
return a;
}
}
package baidu.question;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test15 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入n:");
String value;
try {
value = br.readLine();
while (!isInteger(value)) {
System.out.println("输入的不是整数,请重新输入:");
value = br.readLine();
}
int n = Integer.parseInt(value);
float sum = 0;
for (int i = 1; i <= n; i++) {
sum += (float)1 / count(i);
}
System.out.println(n + "项结果为:" + sum);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static int count(int n) {
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += i;
}
return sum;
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
}
package baidu.question;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test16 {
static int[] b;
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入任意个数字,中间用','隔开,(如1,2,3):");
try {
String value = br.readLine();
while (!checkError(value)) {
System.out.println("输入格式错误,请重新输入:");
value = br.readLine();
}
System.out.println();
System.out.println("排列前:");
for (int i = 0; i < b.length; i++) {
System.out.print(b[i] + ",");
}
System.out.println();
b = maxToMin(b);
System.out.println("排列后:");
for (int i = 0; i < b.length; i++) {
System.out.print(b[i] + ",");
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean checkError(String value) {
if (value == null || value.length() == 0) {
return false;
}
String[] a = value.split(",");
b = new int[a.length];
for (int i = 0; i < a.length; i++) {
if (!isInteger(a[i])) {
return false;
} else {
b[i] = Integer.parseInt(a[i]);
}
}
return true;
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
} catch (Exception e) {
// TODO Auto-generated catch block
return false;
}
return true;
}
public static int[] maxToMin(int[] a) {
for (int i = 0; i < a.length; i++) {
for (int j = i + 1; j < a.length; j++) {
if (a[i] < a[j]) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
return a;
}
}
展开全部
首先点击file--new--java project
project name 任意输入一个字符串,不能有空格! 然后展开该工程,选中SRC文件夹,新建一个class,勾选下面那三个复选框的第一个,最后在建好的class里面的main方法中加入以下打印语句
public void static main(String[] arg){
System.out.println("I Love Internet");
}
project name 任意输入一个字符串,不能有空格! 然后展开该工程,选中SRC文件夹,新建一个class,勾选下面那三个复选框的第一个,最后在建好的class里面的main方法中加入以下打印语句
public void static main(String[] arg){
System.out.println("I Love Internet");
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
file-->new class 把public static main勾上-->确定
加入:System.out.print("I Love Internet");
当前页面->>右键-->run as -->java aplication
加入:System.out.print("I Love Internet");
当前页面->>右键-->run as -->java aplication
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
新建一个java程序,源代码如下
public class LoveInt {
public static void main(String[] args) {
System.out.println("I Love Internet");
}
}
public class LoveInt {
public static void main(String[] args) {
System.out.println("I Love Internet");
}
}
追问
1.在Eclipse中编写一个输出“I Love Internet”的 Java Application程序。
2.在Eclipse中编写一个输出自己的基本信息如姓名和年龄的Applet小程序
3.从键盘输入小写字母,回显并输出其对应的大写字母。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public static void main(String[] args){
System.out.println('I Love Internet");//java中的输出语句
}
System.out.println('I Love Internet");//java中的输出语句
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询