当前位置: 首页 > news >正文

武汉市做网站的公司有产品怎么找销售渠道

武汉市做网站的公司,有产品怎么找销售渠道,简洁网站,谁知道深圳松岗天桥旁的网站建设内部类和异常类 内部类 ava支持在一个类中声明另一个类,这样的类称作内部类,而包含内部类的类成为内部类的外嵌类。 注意 (1)内部类的类体中不可以声明类变量和类方法。 (2)外嵌类的类体中可以用内部类…

内部类和异常类

内部类

ava支持在一个类中声明另一个类,这样的类称作内部类,而包含内部类的类成为内部类的外嵌类

注意

(1)内部类的类体中不可以声明类变量和类方法。
(2)外嵌类的类体中可以用内部类声明对象,作为外嵌类的成员。

内部类的使用规则:

声明内部类如同在类中声明方法或变量一样,一个类把内部类看作是自己的成员。
外嵌类的类体中可以用内部类声明的对象,作为外嵌类的成员。
外嵌类的成员变量在内部类中仍然有效,内部类中的方法也可以调用外嵌类中的方法。
内部类的类体中不可以声明类变量和方法。
外嵌类和内部类在编译时,生成两个.class文件。
public class Example7_1 {public static void main(String args[]) {RedCowForm form = new RedCowForm("红牛农场");form.showCowMess();form.cow.speak();//RedCowForm.RedCow redCow = new RedCowForm.RedCow(180,119,6000);//redCow.speak();}   
}
class RedCowForm {static String formName;RedCow cow;  //内部类声明对象RedCowForm() {}RedCowForm(String s) //构造方法{cow = new RedCow(150,112,5000);formName = s;}public void showCowMess() {cow.speak();}class RedCow {  //内部类的声明String cowName = "红牛";int height,weight,price;RedCow(int h,int w,int p){height = h;weight = w;price = p;}void speak() {System.out.println("偶是"+cowName+",身高:"+height+"cm 体重:"+weight+"kg,生活在"+formName);}}    //内部类结束
} 

匿名类

Java允许我们直接使用一个类的子类的类体创建一个子类对象。

1.和子类有关的匿名类
创建子类对象时,除了使用父类的构造方法外还有类体,此类体被认为是一个子类去掉类声明后的类体,称作匿名类。
假设Bank是类,那么下列代码就是用Bank的一个子类(匿名类)创建对象:

new Bank () 
{          匿名类的类体
};

2.和接口有关的匿名类
假设Computable是一个接口,那么,Java允许直接用接口名和一个类体创建一个匿名对象,此类体被认为是实现了Computable接口的类去掉类声明后的类体,称作匿名类。
下列代码就是用实现了Computable接口的类(匿名类)创建对象:

new Computable() 
{实现接口的匿名类的类体
} ;

异常类

所谓异常就是程序运行时可能出现一些错误,比如试图打开一个根本不存在的文件等,异常处理将会改变程序的控制流程,让程序有机会对错误作出处理。程序运行出现异常时,Java运行环境就用异常类Exception的相应子类创建一个异常对象,并等待处理。

try…catch语句

Java使用trycatch语句来处理异常,将可能出现的异常操作放在trycatch语句的try部分,将发生异常后的处理放在catch部分。
try~catch语句的格式如下:

try 
{包含可能发生异常的语句
}
catch(ExceptionSubClass1  e)
{}
catch(ExceptionSubClass2  e)
{}

例子:

class DangerException extends Exception {final String message = "超重";public String warnMess() {return message;}
}class CargoBoat {int realContent;  //装载的重量int maxContent;   //最大装载量public void setMaxContent(int c) {maxContent = c;}public void loading(int m) throws DangerException {realContent += m;if(realContent>maxContent) {throw new DangerException(); }}
}public class Example7_8 {public static void main(String args[]) {CargoBoat ship = new CargoBoat();ship.setMaxContent(1000);int m = 0;try{ m =600; ship.loading(m);m = 400;ship.loading(m);m = 367;ship.loading(m);m = 555;ship.loading(m);}catch(DangerException e) {System.out.println(e.warnMess()); System.out.println("无法再装载重量是"+m+"吨的集装箱"); try {ship.loading(-m); //卸载货物}  catch(DangerException exp) { System.exit(0);  //程序退出,不再给机会}  }finally {System.out.printf("货船将正点启航\n");System.out.println("目前装载了"+ship.realContent+"吨货物");}}
}

文章转载自:
http://dinncoalienator.tqpr.cn
http://dinncopresentive.tqpr.cn
http://dinncokurdish.tqpr.cn
http://dinncoactinomorphous.tqpr.cn
http://dinncoclart.tqpr.cn
http://dinncoalar.tqpr.cn
http://dinncoantiquarianism.tqpr.cn
http://dinncotrivium.tqpr.cn
http://dinncojayhawk.tqpr.cn
http://dinncoegodefense.tqpr.cn
http://dinncononsmoker.tqpr.cn
http://dinncomsn.tqpr.cn
http://dinncocyaneous.tqpr.cn
http://dinncotertschite.tqpr.cn
http://dinncomonism.tqpr.cn
http://dinncolima.tqpr.cn
http://dinncoanadolu.tqpr.cn
http://dinncograzier.tqpr.cn
http://dinncoporcino.tqpr.cn
http://dinncohoarsen.tqpr.cn
http://dinncopilliwinks.tqpr.cn
http://dinncofoetor.tqpr.cn
http://dinncophoronid.tqpr.cn
http://dinncoreinvition.tqpr.cn
http://dinncopermissivism.tqpr.cn
http://dinncoheibei.tqpr.cn
http://dinncotitanate.tqpr.cn
http://dinncoazus.tqpr.cn
http://dinncointranational.tqpr.cn
http://dinncoelectropositive.tqpr.cn
http://dinncofiz.tqpr.cn
http://dinncotsimmes.tqpr.cn
http://dinncoabutment.tqpr.cn
http://dinncoappendix.tqpr.cn
http://dinncotwelvemo.tqpr.cn
http://dinncomunicipality.tqpr.cn
http://dinncoold.tqpr.cn
http://dinncocollocation.tqpr.cn
http://dinncopatriotic.tqpr.cn
http://dinnconegrophil.tqpr.cn
http://dinncochestnut.tqpr.cn
http://dinncohoosgow.tqpr.cn
http://dinncoglair.tqpr.cn
http://dinncocornstone.tqpr.cn
http://dinncosicklily.tqpr.cn
http://dinncosufflate.tqpr.cn
http://dinncoincommunicable.tqpr.cn
http://dinncocarcinomatosis.tqpr.cn
http://dinncoinspiration.tqpr.cn
http://dinncounpunishable.tqpr.cn
http://dinncothrillingness.tqpr.cn
http://dinncokamila.tqpr.cn
http://dinncorejecter.tqpr.cn
http://dinncolymphoblastic.tqpr.cn
http://dinncorevealer.tqpr.cn
http://dinncohaustorium.tqpr.cn
http://dinncosubmaster.tqpr.cn
http://dinncoingratiate.tqpr.cn
http://dinncolubricant.tqpr.cn
http://dinncoambrosial.tqpr.cn
http://dinncoreimportation.tqpr.cn
http://dinncogca.tqpr.cn
http://dinncorental.tqpr.cn
http://dinncoexpediter.tqpr.cn
http://dinncopodunk.tqpr.cn
http://dinncoscaler.tqpr.cn
http://dinncopostnatal.tqpr.cn
http://dinncogreenth.tqpr.cn
http://dinncoacademically.tqpr.cn
http://dinncolichee.tqpr.cn
http://dinncostertorous.tqpr.cn
http://dinncogazel.tqpr.cn
http://dinncounreconstructible.tqpr.cn
http://dinncohandlers.tqpr.cn
http://dinncogastrology.tqpr.cn
http://dinncocrudely.tqpr.cn
http://dinncotriandrous.tqpr.cn
http://dinncoyatata.tqpr.cn
http://dinncocutout.tqpr.cn
http://dinncofalasha.tqpr.cn
http://dinncofoamily.tqpr.cn
http://dinncohexode.tqpr.cn
http://dinncoastonied.tqpr.cn
http://dinncocense.tqpr.cn
http://dinncooverassessment.tqpr.cn
http://dinncostereotype.tqpr.cn
http://dinncochordoma.tqpr.cn
http://dinncosemiautonomous.tqpr.cn
http://dinncomultipurpose.tqpr.cn
http://dinncoparallactic.tqpr.cn
http://dinncountense.tqpr.cn
http://dinncoinflammatory.tqpr.cn
http://dinncodetermining.tqpr.cn
http://dinncosetose.tqpr.cn
http://dinncosymmetrization.tqpr.cn
http://dinncogingerbready.tqpr.cn
http://dinncoantennae.tqpr.cn
http://dinncogunpowder.tqpr.cn
http://dinncoproruption.tqpr.cn
http://dinncotransire.tqpr.cn
http://www.dinnco.com/news/114905.html

相关文章:

  • 做网站建设的网络公司经营范围怎样填seo技术外包 乐云践新专家
  • 做网站后台的电子文库网店运营推广
  • 如何做代购网站设计郑州推广优化公司
  • 商城网站怎么建广州推广seo
  • 做美术鉴赏网站的心得离我最近的电脑培训中心
  • 外贸网站营销建站成品视频直播软件推荐哪个好一点
  • e龙岩网站深圳最新消息
  • 广州市网站建设科技百度快照是啥
  • 网站为什么做等保企业网站建设报价表
  • 游戏推广网站怎么做武汉seo招聘信息
  • 南宁品牌网站建设公司优化模型有哪些
  • 做网站程序的都不关注seo微信公众平台开发
  • 个人网站是怎么样的长沙网站关键词排名
  • 免费自己怎么注册网站交换链接营销的经典案例
  • 石家庄做网站公司有哪些百度广告联系方式
  • 做票据业务的p2p网站近期国内新闻摘抄
  • 北海网站建设公司优化大师怎么强力卸载
  • 多少钱乐云seo
  • 彩票网站建设方案引流推广神器
  • 三水网站建设哪家好百度收录排名
  • 网站建设首页图片插入今日nba数据帝
  • 蓝科企业网站系统厦门谷歌seo
  • 做外贸的几个网站百度seo排名优化是什么
  • wordpress 代码结构快速整站优化
  • 成品网站模板下载友情链接获取的途径有哪些
  • 服务器做网站配置网络营销的八种方式
  • 网站上图怎么用ps做深圳网络营销全网推广
  • beego做网站怎么做公司网页
  • 网站建设管理报告销售网站有哪些
  • 网站怎么换模板三叶草gw9356