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

网站建设与网页设计开题报告重生主角做视频网站的小说

网站建设与网页设计开题报告,重生主角做视频网站的小说,做网站困难嘛,石家庄网站建设方案本文章就讲的是很基础的类的使用 重点大概就是类的构造函数以及一些很基础的东西。 实验内容是些老生常谈的东西#xff0c;Complex类#xff0c;在当初学C面向对象的时候也是这个样子展开的。 内容如以下#xff1a; public class Complex {float real;float imag;public…本文章就讲的是很基础的类的使用 重点大概就是类的构造函数以及一些很基础的东西。 实验内容是些老生常谈的东西Complex类在当初学C面向对象的时候也是这个样子展开的。 内容如以下 public class Complex {float real;float imag;public Complex(){real 0;imag 0;}public Complex(float real, float imag){this.real real;this.imag imag;}public Complex add(float real){this.real real;return this;}public Complex add(Complex complex){this.real complex.real;this.imag complex.imag;return this;}public Complex sub(float real){this.real - real;return this;}public Complex sub(Complex complex){this.real - complex.real;this.imag - complex.imag;return this;}public Complex mul(float real){this.real * real;this.imag * real;return this;}public Complex mul(Complex complex){float TheReal this.real;float TheImag this.imag;this.real TheReal * complex.real - TheImag*complex.imag;this.imag TheReal * complex.imag TheImag*complex.real;return this;}public String toString(){String str;if(this.imag 0){str this.real;}else if(this.imag 0 ){if(this.real0){str this.imag i;}else str this.real this.imag i;}else{if(this.real0){str this.imag i;}else str this.real this.imag i;}return str;}}这里也不得不说一丁点相关知识–重载 overload 如这里的 public Complex(){real 0;imag 0;}public Complex(float real, float imag){this.real real;this.imag imag;}public Complex add(float real){this.real real;return this;}public Complex add(Complex complex){this.real complex.real;this.imag complex.imag;return this;}这里的Complex()Complex(float real, float imag)构造函数也就用了一些重载的知识。 所谓重载就是函数名不变但是函数内部的参数变化我们调用函数时通过函数里面的参数决定我们要调用哪个函数。 同理的Complex add(float real),Complex add(Complex complex)也是如此当add()的括号里面是一个float值的时候调用Complex add(float real)括号里面是一个Complex对象的时候调用Complex add(Complex complex)。 我当时认为这不是理所当然的吗其实不是的这里是用到了重载overload的知识。 总代码 包com.Class.Work3里的Complex类 package com.Class.Work3;public class Complex {float real;float imag;public Complex(){real 0;imag 0;}public Complex(float real, float imag){this.real real;this.imag imag;}public Complex add(float real){this.real real;return this;}public Complex add(Complex complex){this.real complex.real;this.imag complex.imag;return this;}public Complex sub(float real){this.real - real;return this;}public Complex sub(Complex complex){this.real - complex.real;this.imag - complex.imag;return this;}public Complex mul(float real){this.real * real;this.imag * real;return this;}public Complex mul(Complex complex){float TheReal this.real;float TheImag this.imag;this.real TheReal * complex.real - TheImag*complex.imag;this.imag TheReal * complex.imag TheImag*complex.real;return this;}public String toString(){String str;if(this.imag 0){str this.real;}else if(this.imag 0 ){if(this.real0){str this.imag i;}else str this.real this.imag i;}else{if(this.real0){str this.imag i;}else str this.real this.imag i;}return str;}}调用Complex类的TestWork3类 import com.Class.Work3.Complex;public class TestWork3 {public static void main(String[] args) {Complex c new Complex(1, 2); // c.add(5); // Complex w new Complex(4,1); // c.sub(w); // Complex w2 new Complex(1,2); // c.mul(w2); // c.mul(5);System.out.println(c);} } 就这样了~
http://www.hkea.cn/news/14502946/

相关文章:

  • 电子商务网站的建设方法wordpress站点收录好
  • 长沙市建设网站网店策划书模板
  • 昆明建设网站多少钱繁体中文网站 怎么做
  • 安全标准化建设网站门户网站建设案例
  • 购物网站开发中查看订单的实现逻辑百度网站推广价格查询
  • 网站营销推广有哪些企业营销策划报告
  • 网站开发一般会用到什么语言htm网站
  • 江西那家做网站公司好百度小程序排名优化
  • 学做吃的网站有哪些网站备案信息查询接口
  • 博州住房和城乡建设部网站网站推广的特点
  • 中国风格网站模板做的美食视频网站
  • 网站做推广页需要什么软件青岛营销型网站推广
  • 做网站v1认证需要付费吗站酷网官网入口
  • 物流如何做网站百度网站上传
  • 上海网站建设高端定制网站横幅广告代码
  • 巴彦淖尔市网站建设网站备案变更公司名称
  • 广东智能网站建设哪家有通州网站建设是什么
  • 非凡网站开发培训什么网站做任务可以赚钱
  • 如何做关于橱柜网站可以不花钱做网站吗
  • 福永自适应网站建国际进出口贸易网站
  • 简单的网站建设步骤搭建网站需要哪些步骤
  • 局门户网站的建设狠友紧急升级访问页面
  • 网站开发需要提供哪些东西网站架构文案
  • 网站怎么建立支付平台微信支付宝付款wordpress
  • 重庆营销型网站建设公司郑州个人网站建设
  • wordpress 站群插件北京58网站建设
  • 网站备案需要费用吗ppt模板设计
  • 开发网站监控工具最成功的网络营销案例
  • 超酷win8风格企业网站织梦模板申请企业邮箱步骤是什么?
  • 阿里云做的网站怎么样wordpress瀑布流主 65533