- 博客(11)
- 收藏
- 关注
原创 大一下作业GUI计算器编码题
import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.math.BigDecimal;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JOptionPane;import ja
2021-07-06 07:48:35
126
原创 大一下导出作业编码题List遍历
ArrayList arrayList = new ArrayList();arrayList.add(1);arrayList.add(2);arrayList.add(3); // 增强foreach arrayList.forEach(obj -> System.out.println(obj)); // 转化为数组,然后对数组遍历 // 转化成数组 Object[] array = arrayList.toArray(); // 数组遍历 for (int i = ...
2021-07-05 07:57:51
104
原创 大一下导出作业编码题集合运算
//集合AHashSet hashSetA = new HashSet();Scanner scannerA = new Scanner(System.in);boolean bA = true;while (bA) {int iA = scannerA.nextInt();if (iA != 0) {hashSetA.add(iA);}if (iA == 0) {bA = false;}}//集合BHashSet hashSetB = new HashSet();S...
2021-07-05 07:54:43
132
原创 大一下导出作业编码题IO流
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String password = “”;boolean b = false;for (int i=0; i<5; i++) { password = br.readLine();if (password.equals(“123456”)) {System.out.println(“Congratulations on entering t...
2021-07-05 07:52:21
89
原创 大一下导出作业片段题Map接口——课程信息
import java.util.;import java.util.Map.;public class CourseMapTest {public static void main(String[] args) {Map<String, Course> map = new HashMap<String, Course>();map.put(“178003”, new Course(“math”, 5));map.put(“178018”, new Cours...
2021-07-05 07:48:18
138
原创 大一下导出作业片段题HashSet集合
import java.util.*;public class TestHashSet {public static void main(String[] args) {HashSet hashSet = new HashSet();Person p1 = new Person(“Jack”,25);Person p2 = new Person(“Rose”,23);Person p3 = new Person(“Jack”,27);hashSet.add(p1);hashSet.ad...
2021-07-05 07:45:02
96
原创 大一下导出作业片段题TreeMap倒序
import java.util.*;public class TestTreeMap{public static void main(String[] args) {TreeMap map = new TreeMap(new MyComparator());map.put(“1”, “Lucy”);map.put(“2”, “Lucy”);map.put(“3”, “John”);map.put(“4”, “Smith”);map.put(“5”, “Amanda”);...
2021-07-05 07:40:53
108
原创 大一下导出作业片段题学生各科平均分排序
import java.text.NumberFormat;import java.util.ArrayList;import java.util.Collections;import java.util.List;public class StudentComparable {public static void main(String[] args) {// 创建学生student集合listList list = new ArrayList();// 加入学生信息list...
2021-07-05 07:37:12
133
原创 大一下导出作业片段题Map使用
import java.util.*;public class MapTest{public static void main(String[] args){Map players = new HashMap();players.put(“30”, “Curry”);players.put(“35”, “Durant”);// 加入一个key为11(String类型),value为Thompson(String类型)的元素players.put(“11”, “Thompson”);...
2021-07-05 07:31:00
161
原创 大一下导出作业片段题Set集合遍历
import java.util.*;public class SetTest {public static void main(String[] args) {Set set = new HashSet();set.add(“Hello”);set.add(“World”);set.add(“HaHaHaHaHa”); //1.用增强型for循环进行遍历 for (String str:set) { System.out.println(str); }...
2021-07-05 07:25:36
134
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人