This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sum{ | |
public static void main(String[]args){ | |
int sum=0; | |
int i; | |
for(i=0;i<=100;i++){ | |
if(i%2!=0){ | |
sum+=i; | |
} | |
} | |
System.out.print("SUM="+sum); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Exchange{ | |
public static void main(String[]args){ | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
System.out.println("请输入两个数字:"); | |
int num1=input.nextInt(); | |
int num2=input.nextInt(); | |
System.out.println("现在顺序为"+num1+" "+num2); | |
int c=num1; | |
num1=num2; | |
num2=c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Dao{ | |
public static void main(String[]args){ | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
System.out.println("请输入要倒置的数字:"); | |
int a=input.nextInt(); | |
while(a!=0){ | |
int b=a%10; | |
System.out.print(b); | |
a=a/10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GuessNum{ | |
public static void main(String[]args){ | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
java.util.Random random=new java.util.Random(); | |
int num=random.nextInt(100); | |
System.out.println("系统已经给出一个随机数x(0<=x<100),开始猜数!"); | |
int errorNum=0; | |
while(true){ | |
System.out.println("请输入您猜的数字:"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MaoPao{ | |
public static void main(Stringt[]args){ | |
int[] nums={12,25,9,56,21,35,48,5}; | |
for(int i=1;i<nums.length;i++){ | |
for(int j=0;j<nums.length-i;j++){ | |
if(nums[j]>nums[j+1]){ | |
int temp=nums[j]; | |
nums[j]=nums[j+1]; | |
nums[j+1]=temp; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Login{ | |
public static void main(String[]args){ | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
int errorNum=0; | |
String Lastname=""; | |
while(true){ | |
System.out.println("请输入账户:"); | |
String name=input.next(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Content { | |
private String name; | |
private String tel; | |
private String email; | |
private String QQ; | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Account { | |
private String username; | |
private String password; | |
private double money; | |
private boolean enable; | |
public String getUsername() { | |
return username; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.Inet4Address; | |
import java.net.Inet6Address; | |
import java.net.InetAddress; | |
import java.util.Scanner; | |
public class MyIP { | |
public static void main(String[] args) throws Exception { | |
Scanner input=new Scanner(System.in); | |
System.out.println("输入要判断IP地址的主机名(网站):"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 文件流传输基础类 | |
*/ | |
public class AttachmentDTO implements Serializable { | |
private static final long serialVersionUID = -5616353779779592228L; | |
// 文件名称 | |
private String name; | |
// 文件格式 | |
private String fileExt; | |
// 文件流 |
OlderNewer