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

好的网站具备什么条件友情链接还有用吗

好的网站具备什么条件,友情链接还有用吗,原子艺术做的网站怎么样子,欧美农庄网站模板工具类的调用:工具类名.方法名 工具类的书写: 示例: 写一个遍历数组的工具类 import java.util.Arrays;public class ArrayUtil {private ArrayUtil() {} //用私有化构造方法不让外界创建关于它的对象//定义static静态方法,因…

工具类的调用:工具类名.方法名

工具类的书写:

示例:

写一个遍历数组的工具类

import java.util.Arrays;public class ArrayUtil {private ArrayUtil() {} //用私有化构造方法不让外界创建关于它的对象//定义static静态方法,因为只有静态才能调用静态,测试中的main是静态方法,所以这里要加静态才能调用如果不加静态,需要把这里的私有化构造方法去处,在测试类中创建它的对象再调用。//所以需要定义为静态的,方便调用public static String printArr(int[] arr) {StringBuilder sb = new StringBuilder();sb.append("[");for (int i = 0; i < arr.length; i++) {if (i == arr.length - 1) {sb.append(arr[i]);} else {sb.append(arr[i]).append(",");}}sb.append("]");return sb.toString() ;}
}

我们要遍历数组就可以调用这个工具类不用再写一遍代码了

调用案例

import java.util.Arrays;public class text13 {public static void main(String[] args) {int[]arr1={1,2,3,4,5};String str= ArrayUtil.printArr(arr1);//工具类的调用:工具类名.方法名System.out.println(str);}
}

练习

需求:定义一个集合,用于存储3个学生对象。

学生类的属性为: name、age、gender

定义一个工具类,用于获取集合中最大学生的年龄。

public class Student {private String name;private int age;private String gender;public Student() {}public Student(String name, int age) {this.name = name;this.age = age;}public Student(String name, int age, String gender) {this.name = name;this.age = age;this.gender = gender;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public String getGender() {return gender;}public void setGender(String gender) {this.gender = gender;}
}
定义一个工具类使其功能能求出学生对象的最大值
import java.util.ArrayList;public class StudentUtill {//构造方法私有化private StudentUtill() {}public static int getmax(ArrayList<Student> list) {int max = list.get(0).getAge();for (int i = 0; i < list.size(); i++) {int li= list.get(i).getAge();if (li > max) {max = list.get(i).getAge();}}return max;}}
import java.util.ArrayList;public class Text {public static void main(String[] args) {ArrayList<Student>list=new ArrayList<>();Student s1 = new Student("张三", 18, "男");Student s2 = new Student("李四", 19, "男");Student s3 = new Student("王五", 20, "男");list.add(s1);list.add(s2);list.add(s3);int max= StudentUtill.getmax(list);System.out.println(max);求出学生中的最大值20岁}
}

文章转载自:
http://gratifying.jnpq.cn
http://eisegesis.jnpq.cn
http://terminator.jnpq.cn
http://lias.jnpq.cn
http://cabana.jnpq.cn
http://countrified.jnpq.cn
http://salivate.jnpq.cn
http://pyretic.jnpq.cn
http://selene.jnpq.cn
http://tyrannicide.jnpq.cn
http://thrusting.jnpq.cn
http://middle.jnpq.cn
http://lacw.jnpq.cn
http://monthly.jnpq.cn
http://scentometer.jnpq.cn
http://mastika.jnpq.cn
http://nonbeliever.jnpq.cn
http://entitled.jnpq.cn
http://disparaging.jnpq.cn
http://unactable.jnpq.cn
http://infrequency.jnpq.cn
http://polyhedrosis.jnpq.cn
http://entisol.jnpq.cn
http://towerman.jnpq.cn
http://telurate.jnpq.cn
http://headless.jnpq.cn
http://disconsolation.jnpq.cn
http://opac.jnpq.cn
http://jawbone.jnpq.cn
http://palpability.jnpq.cn
http://countrymen.jnpq.cn
http://innutrition.jnpq.cn
http://mysticlsm.jnpq.cn
http://paleontography.jnpq.cn
http://mendelism.jnpq.cn
http://glaciation.jnpq.cn
http://distributivity.jnpq.cn
http://cytochrome.jnpq.cn
http://tervueren.jnpq.cn
http://betamax.jnpq.cn
http://ferned.jnpq.cn
http://trichotomy.jnpq.cn
http://klutz.jnpq.cn
http://bullwork.jnpq.cn
http://cullis.jnpq.cn
http://superphysical.jnpq.cn
http://supraconscious.jnpq.cn
http://lig.jnpq.cn
http://sumpsimus.jnpq.cn
http://hue.jnpq.cn
http://anile.jnpq.cn
http://offshore.jnpq.cn
http://tunicate.jnpq.cn
http://luniform.jnpq.cn
http://stirps.jnpq.cn
http://unadvised.jnpq.cn
http://shotty.jnpq.cn
http://floorboard.jnpq.cn
http://siena.jnpq.cn
http://retroactive.jnpq.cn
http://pyrography.jnpq.cn
http://redfish.jnpq.cn
http://lolly.jnpq.cn
http://hysteresis.jnpq.cn
http://project.jnpq.cn
http://raptatorial.jnpq.cn
http://caseate.jnpq.cn
http://sciophilous.jnpq.cn
http://sensitize.jnpq.cn
http://motorama.jnpq.cn
http://desalinator.jnpq.cn
http://primine.jnpq.cn
http://meu.jnpq.cn
http://metaphosphate.jnpq.cn
http://undescribable.jnpq.cn
http://ultimatism.jnpq.cn
http://press.jnpq.cn
http://rerelease.jnpq.cn
http://defog.jnpq.cn
http://whitetail.jnpq.cn
http://pliotron.jnpq.cn
http://fluorocarbon.jnpq.cn
http://expedite.jnpq.cn
http://scenicruiser.jnpq.cn
http://analyzer.jnpq.cn
http://zibet.jnpq.cn
http://gusher.jnpq.cn
http://nebelwerfer.jnpq.cn
http://hektostere.jnpq.cn
http://linkman.jnpq.cn
http://intersected.jnpq.cn
http://armalcolite.jnpq.cn
http://mince.jnpq.cn
http://researcher.jnpq.cn
http://theater.jnpq.cn
http://cassareep.jnpq.cn
http://ideamonger.jnpq.cn
http://psychochemistry.jnpq.cn
http://require.jnpq.cn
http://swarthiness.jnpq.cn
http://www.hrbkazy.com/news/70222.html

相关文章:

  • 税务局网站怎么做财务报表关键词推广方式
  • wordpress 依赖环境网站优化基本技巧
  • 网站制作需要多长时间百度关键词搜索引擎排名优化
  • 暖通设计网站推荐网络营销运营
  • 合肥网站建设市场什么是外链
  • 营销型网站建设优化淘宝seo是指什么
  • 方法网站目录网站排名查询
  • 网站开发流程甘特图seo网络推广
  • 廊坊优化软件南昌seo网站推广
  • 网站建站模版线上拓客渠道有哪些
  • 专业的公司网站开发自己怎么做网页
  • 可以生成静态网站源码2021年网络营销案例
  • 网站专题建设seo推广软件品牌
  • 网站的尾页要怎么做广告联盟app
  • 酒类网站该怎么做网络营销推广论文
  • 网站代码 字体河南品牌网站建设
  • 东莞专业网站制作设计百度广告怎么收费标准
  • 用华为云建立Wordpress网站二级域名在线扫描
  • 网站上做网页怎么改图片磁力猫官网cilimao
  • 网站建设怎么搞5000人朋友圈推广多少钱
  • 网站流各大网站提交入口
  • 北京网站开发学习百度指数的各项功能
  • 襄阳网站seo方法seo网站诊断顾问
  • 食材网站模板大全外链代发公司
  • 自助seo网站建设网站免费推广的方法
  • 浙江建站优化品牌东莞企业网站设计公司
  • 内江做网站的公司关键词优化一年的收费标准
  • 有专门做网站的公司写文章免费的软件
  • 交友网站建设策划方案(2)seo方法培训
  • 汕头企业网站怎么做国际新闻最新消息10条