- 博客(11)
- 收藏
- 关注
翻译 Swift as 向下转型的几种形式和用法
as? for casts that are allowed to fail. This would happen if the object is nil or doesn’t have a type that is compatible with the one you’re trying to cast to. It will try to cast to the new type an
2016-07-08 13:17:42
681
原创 列表组件
import javax.swing.*;import java.awt.*;/** * Created by End on 16/1/14. */public class ComboBoxTest { public static void main (String args[]){ EventQueue.invokeLater(new Runnable() {
2016-01-14 22:55:29
235
原创 边框组件
import javax.swing.*;import java.awt.*;/** * Created by End on 16/1/14. */public class BorderTest { public static void main (String args[]){ EventQueue.invokeLater(new Runnable() {
2016-01-14 22:31:40
318
原创 单选按钮组件
package radioButton;import javax.swing.*;import java.awt.*;/** * Created by End on 16/1/14. */public class RadioButtonTest { public static void main (String args[]){ EventQueue.invokeLa
2016-01-14 21:55:54
291
原创 按下按钮圆圈改变颜色
import sun.jvm.hotspot.types.JBooleanField;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class TestDemo implements ActionListener { JFrame frame; public static void m
2015-12-15 23:55:08
1454
原创 创建和使用接口
模式 public interface Shape{ public double getArea(){} public double getVolume(){} public String getName(){}}为使用接口,必须实现该接口的类。(如果一个类没有实现任何接口方法,则它是抽象类,并且必须以关键字abstract声明该类)public class Point imp
2015-12-14 10:59:18
335
原创 final方法和类
-声明为final的类不能为超类,final类中所有的方法都隐式地为final方法。声明为static的方法隐式地为final方法,不能重载超类中所声明的final方法。实际上,String类就是一个声明final的类。
2015-12-14 10:56:59
417
原创 多态性
可以声明用于实现一个或者多个接口的类。实现接口的类必须声明该接口的所有方法。-将子类对象的引用赋给超类类型的变量的做法是安全的,因为子类对象是其超类的对象。然而,该引用只能用于调用超类方法。如果代码通过超类变量来引用子类专用的成员,则编译器将报告错误。观看一下错误代码:Point point;//超类Circle circle = new Circle(120,12,2.4);//子类point
2015-12-14 10:03:23
245
原创 Protected 与 private 的区别
在超类中将成员声明为protected,超类的子类可以继承超类的protected成员。public class Point { protected int x; protected int y; public Point(){} public Point(int x,int y){ this.x=x; this.y=y; }
2015-12-12 22:36:02
792
原创 一个加秒的小程序
一个加秒的小程序import java.awt.*;import java.awt.event.*;import javax.swing.*;public class TimeTest extends JApplet implements ActionListener { private Time time; private JLabel hourLabel, minuteLab
2015-12-12 19:28:36
382
原创 一个简单的设置时间,并用两种形式显示时间。
一个简单的设置时间,并用两种形式显示时间。import javax.swing.*;import java.text.DecimalFormat;public class TimeTest { public static void main(String args[]){ Time1 time = new Time1(); String output="T
2015-12-12 17:16:25
573
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人