![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java作业题
脏眼尾
这个作者很懒,什么都没留下…
展开
-
大一下作业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 · 89 阅读 · 0 评论 -
大一下导出作业编码题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 · 79 阅读 · 0 评论 -
大一下导出作业编码题集合运算
//集合A HashSet 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; } } //集合B HashSet hashSetB = new HashSet(); S...原创 2021-07-05 07:54:43 · 92 阅读 · 0 评论 -
大一下导出作业编码题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 · 58 阅读 · 0 评论 -
大一下导出作业片段题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 · 104 阅读 · 0 评论 -
大一下导出作业片段题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 · 72 阅读 · 0 评论 -
大一下导出作业片段题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 · 78 阅读 · 0 评论 -
大一下导出作业片段题学生各科平均分排序
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集合list List list = new ArrayList(); // 加入学生信息 list...原创 2021-07-05 07:37:12 · 101 阅读 · 0 评论 -
大一下导出作业片段题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 · 139 阅读 · 0 评论 -
大一下导出作业片段题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 · 97 阅读 · 0 评论 -
大一下导出作业选择判断
原创 2021-07-05 07:21:03 · 41 阅读 · 0 评论