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
package test; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class Student{ | |
String sno; |
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
@Controller | |
public class FileUploadController { | |
@Resource | |
private UploadManager uploadManager; | |
@RequestMapping(value = "", method = RequestMethod.POST) | |
public String handleFormUpload(@RequestParam("file") MultipartFile file) { | |
if (!file.isEmpty()) { | |
AttachmentDTO atta = new AttachmentDTO(); | |
atta.setName(file.getOriginalFilename()); | |
atta.setFileBytes(file.getBytes()); |
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; | |
// 文件流 |
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 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
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 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 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 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 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; |
NewerOlder