关键词:
实验十六 线程技术
实验时间 2017-12-8
1.学习总结:
1.程序 是一段静态的代码,它应用程序执行蓝 是一段静态的代码,它应用程序执行蓝 本。
2.进程 是程序的一次动态执行,它对应了从代码加 是程序的一次动态执行,,它对应了从代码加 载、执行至完毕的一个整过程。
3.操作系统为每个进程分配一段独立的内存空间和 系统资源,包括:代码数据以及堆栈等。每 系统资源,包括:代码数据以及堆栈等。每 一个进程的内部数据和状态都是完全独立。
4.多任务操作系统 中,进程切换对 CPU 资源消耗较 大。多线程 是进程执行过中产生的多条线索。 线程是比进执行更小的单位。线程不能独立存在,必须于进 中同一程的各线间共享进空数据。 程的各线共享进空数据。每个线程有它自身的产生、存在和消亡过, 是一个动态的概念。
5.Java 实现多线程有两种途径:
1.创建 Thread 类的子
2.在程序中定义实现 Runnable 接口的类
6.首先需从 Thread 类派生出一个子, 在该子类中 重写 run()方法。
首先设计一个实现 Runnable 接口的类; 接口的类; 接口的类; 接口的类; 接口的类;
7.? 用Runnable() 接口实现线程
1.首先设计一个实现 Runnable 接口的类
2.然后在类中根据需要重写 run 方法;
3再创建该类对象,以此为参数立 再创建该类对象,以此为参数立 Thread类的对象;
4.调用 Thread 类对象的 start 方法启动线程,将 CPU 执行权转交到 run 方法。
8.当线程的 run 方法执行体中最后 一条语句方法执行体中最后 一条语句, 或者出现了在 run 方法中没有捕获的异常时 ,线 程将终止 ,让出 CPU 使用权 。
9.利用各线程的状态变换,可以控制个轮流 利用各线程的状态变换, 使用 CPU ,体现多线程的 并行性特征。
10.线程的终止:当线程的run方法执行方法体中最后一条语句后, 或者出现了在run方法中没有捕获的异常时,线 程将终止,让出CPU使用权。调用interrupt()方法也可终止线程。
11.线程的状态:利用各线程的状态变换,可以控制各个线程轮流 使用CPU,体现多线程的并行性特征。线程有如下7种状态: New (新建) 、Runnable (可运行) 、Running(运行) 、Blocked (被阻塞) 、Waiting (等待) 、Timed waiting (计时等待) 、Terminated (被终止)
12.调用setPriority(int a)重置当前线程的优先级, a 取值可以是前述的三个静态量。
2、实验目的与要求
(1) 掌握线程概念;
(2) 掌握线程创建的两种技术;
(3) 理解和掌握线程的优先级属性及调度方法;
(4) 掌握线程同步的概念及实现技术;
3、实验内容和步骤
实验1:测试程序并进行代码注释。
测试程序1:
l 在elipse IDE中调试运行ThreadTest,结合程序运行结果理解程序;
l 掌握线程概念;
l 掌握用Thread的扩展类实现线程的方法;
l 利用Runnable接口改造程序,掌握用Runnable接口创建线程的方法。
class Lefthand extends Thread 2 public void run() 3 4 for(int i=0;i<=5;i++) 5 System.out.println("You are Students!"); 6 try sleep(500); 7 catch(InterruptedException e) 8 System.out.println("Lefthand error."); 9 10 11 12 class Righthand extends Thread 13 public void run() 14 15 for(int i=0;i<=5;i++) 16 System.out.println("I am a Teacher!"); 17 try sleep(300); 18 catch(InterruptedException e) 19 System.out.println("Righthand error."); 20 21 22 23 public class ThreadTest 24 25 static Lefthand left; 26 static Righthand right; 27 public static void main(String[] args) 28 left=new Lefthand(); 29 right=new Righthand(); 30 left.start(); 31 right.start(); 32 33
package gfhc; class Lefthand implements Runnable public void run() for(int i=0;i<=5;i++) System.out.println("You are Students!"); tryThread.sleep(500); catch(InterruptedException e) System.out.println("Lefthand error."); class Righthand implements Runnable public void run() for(int i=0;i<=5;i++) System.out.println("I am a Teacher!"); try Thread.sleep(300); catch(InterruptedException e) System.out.println("Righthand error."); Lefthand left=new Lefthand (); Righthand right=new Righthand (); public class fgyukg static Lefthand left; static Righthand right; public static void main(String[] args) // left=new Lefthand(); //right=new Righthand(); // left.start (); // right.start(); Runnable Lefthand =new Lefthand (); Thread t=new Thread(Lefthand ); t.start(); Runnable Righthand =new Righthand (); Thread t1=new Thread(Righthand ); t1.start();
测试程序2:
l 在Elipse环境下调试教材625页程序14-1、14-2 、14-3,结合程序运行结果理解程序;
package bounce; import java.awt.geom.*; /** * A ball that moves and bounces off the edges of a rectangle * @version 1.33 2007-05-17 * @author Cay Horstmann */ public class Ball private static final int XSIZE = 15; private static final int YSIZE = 15; private double x = 0; private double y = 0; private double dx = 1; private double dy = 1; /** * Moves the ball to the next position, reversing direction if it hits one of the edges */ public void move(Rectangle2D bounds)//窗口的 x += dx; y += dy; if (x < bounds.getMinX()) x = bounds.getMinX(); dx = -dx; if (x + XSIZE >= bounds.getMaxX()) x = bounds.getMaxX() - XSIZE; dx = -dx; if (y < bounds.getMinY()) y = bounds.getMinY(); dy = -dy; if (y + YSIZE >= bounds.getMaxY()) y = bounds.getMaxY() - YSIZE; dy = -dy; /** * Gets the shape of the ball at its current position. */ public Ellipse2D getShape() return new Ellipse2D.Double(x, y, XSIZE, YSIZE);
package bounce; import java.awt.*; import java.util.*; import javax.swing.*; /** * The component that draws the balls. * @version 1.34 2012-01-26 * @author Cay Horstmann */ public class BallComponent extends JPanel private static final int DEFAULT_WIDTH = 450; private static final int DEFAULT_HEIGHT = 350; private java.util.List<Ball> balls = new ArrayList<>(); /** * Add a ball to the component. * @param b the ball to add */ public void add(Ball b) balls.add(b); public void paintComponent(Graphics g) super.paintComponent(g); // erase background Graphics2D g2 = (Graphics2D) g; for (Ball b : balls) g2.fill(b.getShape()); public Dimension getPreferredSize() return new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT);
package bounce; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Shows an animated bouncing ball. * @version 1.34 2015-06-21 * @author Cay Horstmann */ public class Bounce public static void main(String[] args) EventQueue.invokeLater(() -> JFrame frame = new BounceFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); ); /** * The frame with ball component and buttons. */ class BounceFrame extends JFrame private BallComponent comp; public static final int STEPS = 1000; public static final int DELAY = 3; /** * Constructs the frame with the component for showing the bouncing ball and * Start and Close buttons */ public BounceFrame() //BounceFrame类的addBall方法中有调用comp.paint(comp.getGraphics()) setTitle("Bounce"); comp = new BallComponent(); add(comp, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); addButton(buttonPanel, "Start", event -> addBall()); addButton(buttonPanel, "Close", event -> System.exit(0)); add(buttonPanel, BorderLayout.SOUTH);//将buttonPanel组件整体放在南端 pack(); /** * Adds a button to a container. * @param c the container * @param title the button title * @param listener the action listener for the button */ public void addButton(Container c, String title, ActionListener listener) JButton button = new JButton(title); c.add(button); button.addActionListener(listener); /** * Adds a bouncing ball to the panel and makes it bounce 1,000 times. */ public void addBall()//Start按钮的处理程序将调用addBall try Ball ball = new Ball(); comp.add(ball); for (int i = 1; i <= STEPS; i++) ball.move(comp.getBounds());/调用move方法 comp.paint(comp.getGraphics()); Thread.sleep(DELAY);//Sleep是 Thread累静态方法,用于暂停当前线程的活动。 catch (InterruptedException e) //InterruptedException 只是在发生异常时简单地终止弹跳。
l 在Elipse环境下调试教材631页程序14-4,结合程序运行结果理解程序;
package bounceThread; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Shows animated bouncing balls. * @version 1.34 2015-06-21 * @author Cay Horstmann */ public class BounceThread public static void main(String[] args) EventQueue.invokeLater(() -> JFrame frame = new BounceFrame(); frame.setTitle("BounceThread"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); ); /** * The frame with panel and buttons. */ class BounceFrame extends JFrame private BallComponent comp; public static final int STEPS = 1000; public static final int DELAY = 5; /** * Constructs the frame with the component for showing the bouncing ball and * Start and Close buttons */ public BounceFrame() comp = new BallComponent(); add(comp, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); addButton(buttonPanel, "Start", event -> addBall()); addButton(buttonPanel, "Close", event -> System.exit(0)); add(buttonPanel, BorderLayout.SOUTH); pack(); /** * Adds a button to a container. * @param c the container * @param title the button title * @param listener the action listener for the button */ public void addButton(Container c, String title, ActionListener listener) JButton button = new JButton(title); c.add(button); button.addActionListener(listener); /** * Adds a bouncing ball to the canvas and starts a thread to make it bounce */ public void addBall() Ball ball = new Ball(); comp.add(ball);
//引用实现了Runnable的方法 Runnable r = () -> try for (int i = 1; i <= STEPS; i++) ball.move(comp.getBounds()); comp.repaint(); Thread.sleep(DELAY); catch (InterruptedException e) ; Thread t = new Thread(r);//用Runnable创建一个Thread对象
t.start();//启动线程
l 对比两个程序,理解线程的概念和用途;
l 掌握线程创建的两种技术。
测试程序3:分析以下程序运行结果并理解程序。
class Race extends Thread public static void main(String args[]) Race[] runner=new Race[4]; for(int i=0;i<4;i++) runner[i]=new Race( ); for(int i=0;i<4;i++) runner[i].start( ); runner[1].setPriority(MIN_PRIORITY); runner[3].setPriority(MAX_PRIORITY); public void run( ) for(int i=0; i<1000000; i++); System.out.println(getName()+"线程的优先级是"+getPriority()+"已计算完毕!");
|
class Race extends Thread
public static void main(String args[])
Race[] runner = new Race[4];
for (int i = 0; i < 4; i++)
runner[i] = new Race();
for (int i = 0; i < 4; i++)
runner[i].start();
runner[1].setPriority(MIN_PRIORITY);
runner[3].setPriority(MAX_PRIORITY);
public void run()
for (int i = 0; i < 1000000; i++);//用来延时
System.out.println(getName() + "线程的优先级是" + getPriority() + "已计算完!");
测试程序4
l 教材642页程序模拟一个有若干账户的银行,随机地生成在这些账户之间转移钱款的交易。每一个账户有一个线程。在每一笔交易中,会从线程所服务的账户中随机转移一定数目的钱款到另一个随机账户。
l 在Elipse环境下调试教材642页程序14-5、14-6,结合程序运行结果理解程序;
package unsynch; import java.util.*; /** * A bank with a number of bank accounts. * @version 1.30 2004-08-01 * @author Cay Horstmann */ public class Bank private final double[] accounts; /** * Constructs the bank. * @param n the number of accounts * @param initialBalance the initial balance for each account */ public Bank(int n, double initialBalance) accounts = new double[n]; Arrays.fill(accounts, initialBalance);//将指定的 double 值分配给指定 double 型数组的每个元素 /** * Transfers money from one account to another. * @param from the account to transfer from * @param to the account to transfer to * @param amount the amount to transfer */ public void transfer(int from, int to, double amount) if (accounts[from] < amount) return; System.out.print(Thread.currentThread()); accounts[from] -= amount; System.out.printf(" %10.2f from %d to %d", amount, from, to); accounts[to] += amount; System.out.printf(" Total Balance: %10.2f%n", getTotalBalance()); /** * Gets the sum of all account balances. * @return the total balance */ public double getTotalBalance() double sum = 0; for (double a : accounts) sum += a; return sum; /** * Gets the number of accounts in the bank. * @return the number of accounts */ public int size() return accounts.length;
package unsynch; /** * This program shows data corruption when multiple threads access a data structure. * @version 1.31 2015-06-21 * @author Cay Horstmann */ public class UnsynchBankTest public static final int NACCOUNTS = 100; public static final double INITIAL_BALANCE = 1000; public static final double MAX_AMOUNT = 1000; public static final int DELAY = 10; public static void main(String[] args) Bank bank = new Bank(NACCOUNTS, INITIAL_BALANCE); for (int i = 0; i < NACCOUNTS; i++) int fromAccount = i; Runnable r = () -> try while (true) int toAccount = (int) (bank.size() * Math.random()); double amount = MAX_AMOUNT * Math.random(); bank.transfer(fromAccount, toAccount, amount); Thread.sleep((int) (DELAY * Math.random())); catch (InterruptedException e) ; Thread t = new Thread(r); t.start();
综合编程练习
编程练习1
- 设计一个用户信息采集程序,要求如下:
(1) 用户信息输入界面如下图所示:
(2) 用户点击提交按钮时,用户输入信息显示控制台界面;
(3) 用户点击重置按钮后,清空用户已输入信息;
(4) 点击窗口关闭,程序退出。
import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class WinCenter public static void center(Window win) Toolkit tkit = Toolkit.getDefaultToolkit(); Dimension sSize = tkit.getScreenSize(); Dimension wSize = win.getSize(); if(wSize.height > sSize.height) wSize.height = sSize.height; if(wSize.width > sSize.width) wSize.width = sSize.width; win.setLocation((sSize.width - wSize.width)/ 2, (sSize.height - wSize.height)/ 2);
import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ButtonModel; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; public class DemoJFrame extends JFrame private JPanel jPanel1; private JPanel jPanel2; private JPanel jPanel3; private JPanel jPanel4; private JTextField fieldname; private JComboBox comboBox; private JTextField fieldadress; private ButtonGroup bg; private JRadioButton male; private JRadioButton female; private JCheckBox read; private JCheckBox movie; private JCheckBox learn; public DemoJFrame() // 设置窗口大小 this.setSize(800, 400); // 设置可见性 this.setVisible(true); // 设置标题 this.setTitle("编程练习一"); // 设置关闭操作 this.setDefaultCloseOperation(EXIT_ON_CLOSE); // 设置窗口居中 WinCenter.center(this); // 创建四个面板对象 jPanel1 = new JPanel(); setJPanel1(jPanel1); jPanel2 = new JPanel(); setJPanel2(jPanel2); jPanel3 = new JPanel(); setJPanel3(jPanel3); jPanel4 = new JPanel(); setJPanel4(jPanel4); // 设置容器的为流布局 FlowLayout flowLayout = new FlowLayout();//构造一个新的 FlowLayout,它是居中对齐的 this.setLayout(flowLayout); // 将四个面板添加到容器中 this.add(jPanel1); this.add(jPanel2); this.add(jPanel3); this.add(jPanel4); /* * 设置面一 */ private void setJPanel1(JPanel jPanel) // TODO 自动生成的方法存根 jPanel.setPreferredSize(new Dimension(700, 45)); // 给面板的布局设置为网格布局 一行4列 jPanel.setLayout(new GridLayout(1, 4)); JLabel name = new JLabel("姓名:"); name.setSize(100, 50); fieldname = new JTextField(""); fieldname.setSize(80, 20); JLabel study = new JLabel("学历:"); comboBox = new JComboBox(); comboBox.addItem("初中"); comboBox.addItem("高中"); comboBox.addItem("本科"); jPanel.add(name); jPanel.add(fieldname); jPanel.add(study); jPanel.add(comboBox); /* * 设置面板二 */ private void setJPanel2(JPanel jPanel) // TODO 自动生成的方法存根 jPanel.setPreferredSize(new Dimension(700, 50)); // 给面板的布局设置为网格布局 一行4列 jPanel.setLayout(new GridLayout(1, 4)); JLabel name = new JLabel("地址:"); fieldadress = new JTextField(); fieldadress.setPreferredSize(new Dimension(150, 50)); JLabel study = new JLabel("爱好:"); JPanel selectBox = new JPanel(); selectBox.setBorder(BorderFactory.createTitledBorder(""));//创建一个新标题边框 selectBox.setLayout(new GridLayout(3, 1));//创建具有指定行数和列数的网格布局。给布局中的所有组件分配相等的大小。 read = new JCheckBox("读书"); movie = new JCheckBox("看电影"); learn = new JCheckBox("学习"); selectBox.add(read); selectBox.add(movie); selectBox.add(learn); jPanel.add(name); jPanel.add(fieldadress); jPanel.add(study); jPanel.add(selectBox); /* * 设置面板三 */ private void setJPanel3(JPanel jPanel) // TODO 自动生成的方法存根 jPanel.setPreferredSize(new Dimension(700, 150)); FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT); jPanel.setLayout(flowLayout); JLabel sex = new JLabel("性别:"); JPanel selectBox = new JPanel(); selectBox.setBorder(BorderFactory.createTitledBorder("")); selectBox.setLayout(new GridLayout(2, 1)); bg = new ButtonGroup(); male = new JRadioButton("男"); female = new JRadioButton("女"); bg.add(male); bg.add(female); selectBox.add(male); selectBox.add(female); jPanel.add(sex); jPanel.add(selectBox); /* * 设置面板四 */ private void setJPanel4(JPanel jPanel) // TODO 自动生成的方法存根 jPanel.setPreferredSize(new Dimension(700, 150)); FlowLayout flowLayout = new FlowLayout(FlowLayout.CENTER, 50, 10); jPanel.setLayout(flowLayout); jPanel.setLayout(flowLayout); JButton sublite = new JButton("提交"); JButton reset = new JButton("重置"); sublite.addActionListener((e) -> valiData()); reset.addActionListener((e) -> Reset());//给提交和重置按钮创建监听器 jPanel.add(sublite); jPanel.add(reset); /* * 提交数据 */ private void valiData() // TODO 自动生成的方法存根 // 拿到数据 String name = fieldname.getText().toString().trim(); String xueli = comboBox.getSelectedItem().toString().trim(); String address = fieldadress.getText().toString().trim(); System.out.println(name); System.out.println(xueli); String hobbystring=""; if (read.isSelected()) hobbystring+="读书 "; if (movie.isSelected()) hobbystring+="看电影 "; if (learn.isSelected()) hobbystring+="学习 "; System.out.println(address); if (male.isSelected()) System.out.println("男"); if (female.isSelected()) System.out.println("女"); System.out.println(hobbystring); /* * 重置 */ private void Reset() // TODO 自动生成的方法存根 fieldadress.setText(null); fieldname.setText(null); comboBox.setSelectedIndex(0); read.setSelected(false); movie.setSelected(false); learn.setSelected(false); bg.clearSelection();
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Main
public static void main(String[] args)
EventQueue.invokeLater(() ->
DemoJFrame page = new DemoJFrame();
);
2.创建两个线程,每个线程按顺序输出5次“你好”,每个“你好”要标明来自哪个线程及其顺序号。
package project2; class Lefthand extends Thread public void run() for(int i=0;i<=4;i++) System.out.println("1.你好"); try sleep(500); catch(InterruptedException e) System.out.println("Lefthand error."); class Righthand extends Thread public void run() for(int i=0;i<=4;i++) System.out.println("2.你好"); try sleep(300); catch(InterruptedException e) System.out.println("Righthand error."); public class ThreadText static Lefthand left; static Righthand right; public static void main(String[] args) left=new Lefthand(); right=new Righthand(); left.start(); right.start();
实验总结:这次实验运行多个程序的能力。例:操作系统将CPU的时间片分配给每一个进程,给人并行处理的感觉。
重要比较了多线程和多进程有哪些区别等,好多知识的收获。
201771010101白玛次仁《2018面向对象程序设计(java)》第九周学习总结
实验九异常、断言与日志实验时间2018-10-251.知识总结:异常:在程序的执行过程中所发生的异常事件,它中断指令正常执行。程序中出现的常见的错误和问题有:用户输入错误设备错误物理限制代码错误Java把程序运行时可能遇... 查看详情
201771010101白玛次仁《2018面向对象程序设计(java)》第七周学习总结
实验七继承附加实验实验时间2018-10-111.继承的概念:继承在本职上是特殊——一般的关系,即常说的is-a关系。子类继承父类,表明子类是一种特殊的父类,并且具有父类所不具有的一些属性或方法。2.继承中的初始化顺序:从类... 查看详情
201771010101白玛次仁《面向对象程序设计(java)》第十二周实验总结
实验十二 图形程序设计实验时间 2018-11-14学习总结:1.Java的抽象口工具箱(AbstractWindowToolkit,AWT)包含在java.awt包中,它提供了许多用来设计GUI的组件类和容器类。2.AWT库处理用户界面元素的方法:把图形元素的创... 查看详情
201771010101白玛次仁
本人学号《面向对象程序设计(java)》第一周学习总结第一部分:课程准备部分填写课程学习平台注册账号,平台名称注册账号博客园:www.cnblogs.com 程序设计评测:https://pintia.cn/[email protected]代码托管平台:https://github.c... 查看详情
实验六201771010101白玛次仁
第五章 继承总结实验六继承定义与使用实验时间2018-9-281.类,超类与子类继承Employee类来定义Manager类格式,关键字extends表示继承。Class新类名(子类(subclass),派生类(derivedclass)或孩子类(chideclass))。extends已有类名(超类... 查看详情
201771010101白玛次仁《2018面向对象程序设计(java)》第十七周学习总结(代码片段)
实验十七 线程同步控制实验时间2018-12-101. 知识总结:多线程并发运行不确定性问题解决方案:引入线程同步机制,使得另一线程要使用该方法,就只能等待。 在Java中解决多线程同步问题的方法有两种:-JavaSE5.0中引... 查看详情
201771010101白玛次仁《2018面向对象程序设计(java)》第十六周学习总结(代码片段)
实验十六 线程技术实验时间 2017-12-81.学习总结:1.程序是一段静态的代码,它应用程序执行蓝是一段静态的代码,它应用程序执行蓝本。2.进程是程序的一次动态执行,它对应了从代码加是程序的一次动态执行,,它... 查看详情
20177101010101白玛次仁《面向对象程序设计》第十八周学习总结(代码片段)
实验十八 总复习实验时间2018-12-301、实验目的与要求(1)综合掌握java基本程序结构;(2) 综合掌握java面向对象程序设计特点;(3)综合掌握javaGUI 程序设计结构;(4)综合掌握java多线程编程模型;(5)综合编程练习。2、实验... 查看详情
2018-3-5面向对象(代码片段)
今天学习了有关“面向对象”的内容:传统的面向对象:把将要完成的工作,一个步骤一个步骤的实现,最终完成目标。现代的面向对象:把要做的事情提前存起来,等到需要用的时候调用,相当于设计方法和方法的调用。面向... 查看详情
2018面向对象程序设计(java)第18周学习指导及要求
2018面向对象程序设计(Java)第18周学习指导及要求(2018.12.27-2018.12.30) 学习目标(1)综合掌握java基本程序结构;(2)综合掌握java面向对象程序设计特点;(3)综合掌握javaGUI程序设计结构;(4)综合掌握java多线程编程模型;(5)综合... 查看详情
2018面向对象程序设计(java)第一周
2018面向对象程序设计(Java)第1周学习指导及要求(2018.8.24-2018.9.2) 学习目标了解课程上课方式及老师教学要求,掌握课程学习必要的软件工具;简单了解Java特点及历史;理解JVM、JRE与JDK等概念,学会下载、安装、测试JDK... 查看详情
2018.1.13面向对象之继承复习
classRect{ intwidth=2,height=6; voidsetWidth(intwidth){ this.width=width; //代码1将参数的值赋给成员变量width } voidsetHeight(intheight){ this.height=height; //代码2将参数的值赋给成员变量height } intgetArea(){ returnwidth* 查看详情
2018面向对象程序设计(java)第9周学习指导及要求
2018面向对象程序设计(Java)第9周学习指导及要求(2018.10.25-2018.10.28) 学习目标1.掌握java异常处理技术;2.了解断言的用法;3.了解日志的用途;4.掌握程序基础调试技巧。学习资源1.教材第7章2.第7章教学课件3.corejava.zip4.实... 查看详情
betascrummeeting2
Beta冲刺第二天:2020.6.271.1成员今日分工成员分工白玛次仁录制功能测试视频穷吉软件各项功能测试罗松编写博客焦旭超软件各项功能测试 1.2 今日发现了哪些Bug,描述发现Bug的测试用例和Bug的修复情况;1) json字... 查看详情
betascrummeeting3
Beta冲刺第三天:2020.6.281.1成员今日分工成员分工白玛次仁录制测试视频穷吉软件各项功能测试,修复bug罗松软件各项功能测试,修复bug焦旭超编写博客1.2 今日发现了哪些Bug,描述发现Bug的测试用例和Bug的修复情况;1)微信... 查看详情
2018面向对象程序设计(java)第16周学习指导及要求
2018面向对象程序设计(Java)第17周学习指导及要求(2018.12.20-2018.12.23) 学习目标(1)掌握线程同步的概念及实现技术;(2)Java线程综合编程练习学习资源1.教材第14章2.第14章教学课件3.corejava.zip4.实验十七任务书学习任务增补《... 查看详情
2018年四川理工学院软件工程考试大纲(面向对象的软件开发技术概述)
2018年四川理工学院软件工程考试大纲(面向对象的软件开发技术概述) 1、面向对象软件开发,需要建立哪三种模型 ①、对象模型(用于描述系统的数据结构,定义了系统“对谁做”) ②、动态模型(定义了系统“... 查看详情
2018-2019-220175202实验二《java面向对象程序设计》实验报告
2018-2019-220175202实验二《Java面向对象程序设计》实验报告一、实验内容1.初步掌握单元测试和TDD2.理解并掌握面向对象三要素:封装、继承、多态3.初步掌握UML建模4.熟悉S.O.L.I.D原则5.了解设计模式二、实验要求1.没有Linux基础的同... 查看详情