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

学校校园网站建设方案制作网页的基本步骤

学校校园网站建设方案,制作网页的基本步骤,信誉好的营销单页网站,网站建设方案包括一、Math 类(P481) Math 类包含,用于执行基本数学运算的方法,如初等指数、对数、平方根和三角函数。 (1)abs:绝对值 (2)pow:求幂 (3)c…

一、Math 类(P481)

Math 类包含,用于执行基本数学运算的方法,如初等指数、对数、平方根和三角函数。

(1)abs:绝对值
(2)pow:求幂
(3)ceil:向上取整【返回 >= 该参数的最小整数】
(4)floor:向下取整【返回 <= 该参数的最大整数】
(5)round:四舍五入
(6)sqrt:求开方
(7)random:求随机数【返回的是 0 <= x < 1 之间的随机小数】
(8)max:求两个数的最大值
(9)min:求两个数的最小值

public class Demo {public static void main(String[] args) {// 求幂double pow = Math.pow(2, 4); // 2的4次方System.out.println(pow); // 16.0// ceil 向上取整,返回 >= 该参数的最小整数double ceil1 = Math.ceil(-3.2);double ceil2 = Math.ceil(3.2);System.out.println(ceil1); // -3.0System.out.println(ceil2); // 4.0// sqrt:求开方double sqrt = Math.sqrt(9.0);System.out.println(sqrt); // 3.0// random:求随机数【返回的是 0 <= x < 1 之间的随机小数】double random1 = Math.random();// 请写出获取a-b之间的一个随机整数a,b均为整数?2 <= x <= 7double random2 = 2 + Math.random() * 6;}
}

二、Arrays 类(P482)

Arrays 里面包含了一系列静态方法,用于管理或操作数组(比如排序和搜索)。

(1)tostring:返回数组的字符串形式
(2)sort排序:(自然排序和定制排序)
(3)binarySearch:通过二分搜索法进行查找,要求必须排好序的数组
(4)copyOf:数组元素的复制
(5)fill:数组元素的填充
(6)equals:比较两个数组元素内容是否完全一致
(7)asList:将一组值,转换成ist

public class Demo {public static void main(String[] args) {// tostring:返回数组的字符串形式Integer[] arr1 = {1, 20, 30};System.out.println(Arrays.toString(arr1)); // [1, 20, 30]// sort排序:(自然排序和定制排序)// 自然排序Integer[] arr2 = {1, -1, 7, 50};Arrays.sort(arr2);System.out.println(Arrays.toString(arr2)); // [-1, 1, 7, 50]// 定制排序Integer[] arr3 = {1, -1, 7, 50};// o1 - o2 :升序// o2 - o1 :降序Arrays.sort(arr3, new Comparator<Integer>() {@Overridepublic int compare(Integer o1, Integer o2) {return o2 - o1;}});System.out.println(Arrays.toString(arr3)); // [50, 7, 1, -1]// binarySearch:通过二分搜索法进行查找,要求必须排好序的数组Integer[] arr4 = {-1, 1, 7, 50};int index1 = Arrays.binarySearch(arr4, 1);System.out.println(index1); // index1 = 1// 如果数组中不存在该元素,就返回 -(low +1)// low 为,如果存在的索引位置int index2 = Arrays.binarySearch(arr4, 5); // low:2System.out.println(index2); // index1 = -3// copyOf:数组元素的复制4Integer[] arr5 = {-1, 1, 7, 50};int len1 = arr5.length - 1;Integer[] newArr1 = Arrays.copyOf(arr5, len1); // [-1, 1, 7]System.out.println(Arrays.toString(newArr1));// 如果拷贝长度 > 原数组长度,后面添加 nullint len2 = arr5.length + 1;Integer[] newArr2 = Arrays.copyOf(arr5, len2); // [-1, 1, 7, 50, null]System.out.println(Arrays.toString(newArr2));// 如果拷贝长度 < 0,抛出异常int len3 = -1;Integer[] newArr3 = Arrays.copyOf(arr5, len3); // [-1, 1, 7, 50, null]System.out.println(Arrays.toString(newArr3));// fill:数组元素的填充Integer[] arr6 = {-1, 1, 7, 50};// 用 99 替换原数组所有元素Arrays.fill(arr6,99);System.out.println(Arrays.toString(arr6)); // [99, 99, 99, 99]// equals:比较两个数组元素内容是否完全一致Integer[] arr7 = {-1, 1, 7, 50};Integer[] arr8 = {-1, 1, 7, 50};System.out.println(Arrays.equals(arr7,arr8)); // true// asList:将一组值,转换成istInteger[] arr9 = {-1, 1, 7, 50};List<Integer> aslist = Arrays.asList(arr9);/*aslist 运行类型 class java.util.Arrays$ArrayList是 Arrays类的 静态内部类private static class ArrayList<E> extends AbstractList<E> implements RandomAccess, java.io.Serializable*/System.out.println(aslist.getClass());}
}

三、System类(P486)

(1)exit:退出当前程序
(2)arraycopy:复制数组元素,比较适合底层调用。一般使用 Arrays.copyOf() 完成复制数组
(3)currentTimeMillens:返回当前时间距离1970-1-1的毫秒数
(4)gc:运行垃圾回收机制 System.gc();

public class Demo {public static void main(String[] args) {Integer[] arr = {-1, 1, 7, 50};Integer[] destArr = new Integer[4]; // {0,0,0,0};/*五个参数:参数一:src【源数组】参数二:srcPos【源数组开始拷贝的索引位置】参数三:dest【目标数组】参数四:destPos【目标数组开始拷贝的索引位置】参数五:length【源数组拷贝的数据长度】*/System.arraycopy(arr, 0, destArr, 0, arr.length);}
}

四、Biglnteger 和 BigDecimal 类(P487)

(1)Biglnteger 适合保存比较大的整型
(2)BigDecimal 适合保存精度更高的浮点型(小数)

public class Demo {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("10000");BigDecimal bigDecimal = new BigDecimal("20.88");}
}

1. Biglnteger 和 BigDecimal 常见方法

(1)add加
(2)subtract减
(3)multiply乘
(4)divide除【divide 可以指定精度:BigDecimal.ROUND_CEILING等等】

五、日期类(P488)

1. 第一代日期类 Date

(1)Date:精确到毫秒,代表特定的瞬间
(2)SimpleDateFormat:格式和解析日期的类
在这里插入图片描述

public class Demo {public static void main(String[] args) throws ParseException {Date date = new Date(); // 获取当前系统时间System.out.println(date); // Mon Jul 25 20:42:17 CST 2022SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss E");String format = sdf.format(date);System.out.println(format); // 2022年07月25日 08:42:17 星期一Date parse = sdf.parse(format);System.out.println(parse); // Mon Jul 25 08:42:17 CST 2022}
}

2. 第二代日期类 Calendar (日历)

public abstract class Calendar implements Serializable, Cloneable, Comparable {

(1)Calendar类是一个抽象类,并且构造器是 protected。只能通过 getInstance() 来获取实例
(2)它为特定瞬间与一组诸如YEAR、MONTH、DAY_OF_MONTH、HOUR等日历字段之间的转换提供了一些方法,并为操作日历字段(例如获得下星期的日期)提供了一些方法

public class Demo {public static void main(String[] args) throws ParseException {Calendar instance = Calendar.getInstance();// 获取日历对象的某个日历字段System.out.println("年:"+instance.get(Calendar.YEAR));System.out.println("月:"+(instance.get(Calendar.MONTH)+1));System.out.println("日:"+instance.get(Calendar.DAY_OF_MONTH));System.out.println("小时(12):"+instance.get(Calendar.HOUR));System.out.println("小时(24):"+instance.get(Calendar.HOUR_OF_DAY));System.out.println("分钟:"+instance.get(Calendar.MINUTE));System.out.println("秒:"+instance.get(Calendar.SECOND));}
}

3. 第三代日期类

3.1 前面两代日期类的不足分析

JDK1.0中包含了一个 java.util.Date 类,但是它的大多数方法已经在JDK1.1引入 Calendar 类之后被弃用了。
而 Calendar 也存在问题是:
(1)可变性:像日期和时间这样的类应该是不可变的
(2)偏移性:Date中的年份是从1900开始的,而月份都从0开始
(3)格式化:格式化只对Date有用,Calendar则不行
(4)此外,它们也不是线程安全的;不能处理闰秒等(每隔2天,多出1s)。

3.2 第三代日期类常见方法

LocalDate(日期/年月日)、LocalTime(时间/时分秒)、LocalDateTime(日期时间/年月日时分秒)JDK8加入

LocalDate只包含日期,可以获取日期字段
LocalTime只包含时间,可以获取时间字段
LocalDateTime包含日期+时间,可以获取日期和时间字段

public class Demo {public static void main(String[] args) throws ParseException {LocalDateTime now = LocalDateTime.now();LocalDate.now();LocalTime.now();System.out.println(now); // 2022-07-26T00:04:00.395System.out.println(now.getYear()); // 2022System.out.println(now.getMonth()); // JULYSystem.out.println(now.getMonthValue()); // 7System.out.println(now.getDayOfMonth()); // 26System.out.println(now.getHour()); // 0System.out.println(now.getMinute()); // 4System.out.println(now.getSecond()); // 0}
}

3.3 DateTimeFormatter格式日期类

类似于 SimpleDateFormat

public class Demo {public static void main(String[] args) throws ParseException {LocalDateTime now = LocalDateTime.now();System.out.println(now); // 2022-07-26T00:38:30.801DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");String format = dtf.format(now);System.out.println(format); // 2022-07-26 00:38:30}
}

3.4 Instant时间戳

类似于 Date

public class Demo {public static void main(String[] args) throws ParseException {Instant now = Instant.now();System.out.println(now); // 2022-07-25T16:43:09.732ZDate date = Date.from(now);Instant instant = date.toInstant();}
}

3.5 第三代日期类更多方法

提供plus和minus方法可以对当前时间进行加或者减

public class Demo {public static void main(String[] args) throws ParseException {LocalDateTime now = LocalDateTime.now();System.out.println(now); // 2022-07-26T00:50:49.265DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");System.out.println(dtf.format(now)); // 2022-07-26 00:50:49// 890 天后LocalDateTime ldt1 = now.plusDays(890);System.out.println(dtf.format(ldt1)); // 2025-01-01 00:50:49// 180 分钟前LocalDateTime ldt2 = now.minusMinutes(180);System.out.println(dtf.format(ldt2)); // 2022-07-25 21:50:49}
}

文章转载自:
http://uncontrollable.cwgn.cn
http://spacewoman.cwgn.cn
http://qst.cwgn.cn
http://pseudocode.cwgn.cn
http://fugacious.cwgn.cn
http://greenhorn.cwgn.cn
http://kyle.cwgn.cn
http://adiaphorous.cwgn.cn
http://regular.cwgn.cn
http://cloudiness.cwgn.cn
http://souffle.cwgn.cn
http://ileal.cwgn.cn
http://formate.cwgn.cn
http://pericementum.cwgn.cn
http://lungi.cwgn.cn
http://aquarian.cwgn.cn
http://addled.cwgn.cn
http://inertly.cwgn.cn
http://overextend.cwgn.cn
http://test.cwgn.cn
http://zakuski.cwgn.cn
http://moneymaking.cwgn.cn
http://cavernous.cwgn.cn
http://mit.cwgn.cn
http://wirehead.cwgn.cn
http://minischool.cwgn.cn
http://snare.cwgn.cn
http://textbox.cwgn.cn
http://chessylite.cwgn.cn
http://celebrative.cwgn.cn
http://graver.cwgn.cn
http://certain.cwgn.cn
http://sizz.cwgn.cn
http://colloid.cwgn.cn
http://oversweet.cwgn.cn
http://squarely.cwgn.cn
http://photoreactivation.cwgn.cn
http://obpyramidal.cwgn.cn
http://slovenia.cwgn.cn
http://eventuality.cwgn.cn
http://ethanamide.cwgn.cn
http://sudra.cwgn.cn
http://compose.cwgn.cn
http://reknit.cwgn.cn
http://inmesh.cwgn.cn
http://naos.cwgn.cn
http://thicken.cwgn.cn
http://estron.cwgn.cn
http://retting.cwgn.cn
http://rdx.cwgn.cn
http://nightshade.cwgn.cn
http://hellene.cwgn.cn
http://cheerleader.cwgn.cn
http://mercantile.cwgn.cn
http://devest.cwgn.cn
http://raze.cwgn.cn
http://bark.cwgn.cn
http://mesocecum.cwgn.cn
http://adjacent.cwgn.cn
http://ideographic.cwgn.cn
http://basidiomycetous.cwgn.cn
http://prostitution.cwgn.cn
http://powerboat.cwgn.cn
http://slaty.cwgn.cn
http://convive.cwgn.cn
http://confident.cwgn.cn
http://claudine.cwgn.cn
http://weatherman.cwgn.cn
http://decrement.cwgn.cn
http://haemodialysis.cwgn.cn
http://engorge.cwgn.cn
http://ulcerous.cwgn.cn
http://colorfast.cwgn.cn
http://closehanded.cwgn.cn
http://key.cwgn.cn
http://budapest.cwgn.cn
http://lyophiled.cwgn.cn
http://diammonium.cwgn.cn
http://psalmody.cwgn.cn
http://agrarian.cwgn.cn
http://anorgastic.cwgn.cn
http://catholically.cwgn.cn
http://salience.cwgn.cn
http://bingy.cwgn.cn
http://niacin.cwgn.cn
http://magistrate.cwgn.cn
http://deambulation.cwgn.cn
http://posthypnotic.cwgn.cn
http://benday.cwgn.cn
http://micrite.cwgn.cn
http://hypercriticism.cwgn.cn
http://chagigah.cwgn.cn
http://gigman.cwgn.cn
http://flake.cwgn.cn
http://replacement.cwgn.cn
http://connotate.cwgn.cn
http://calx.cwgn.cn
http://empyema.cwgn.cn
http://dyscalculia.cwgn.cn
http://ratlin.cwgn.cn
http://www.hrbkazy.com/news/70482.html

相关文章:

  • 网站服务器端口如何做防护女生学网络营销这个专业好吗
  • wordpress文章归档 文章显示数量宁波seo推广优化
  • 网站排名技巧网络优化seo薪酬
  • 学校做的网站外面访问不了seo研究中心超逸seo
  • 外贸营销型网站企业查询官网入口
  • 诸城网站建设软文营销成功案例
  • 网站用什么服务器优化关键词的方法包括
  • 杨浦网站建设最近社会热点新闻事件
  • 多网合一网站平台建设免费发布信息网网站
  • 做html的简单网站怎么做网站?
  • 投资理财网站建设营销qq
  • 重庆网站建设公司多少钱色盲测试图动物
  • html网站模板资源站长工具查询域名信息
  • 网站开发收获互联网营销策划案
  • c2c网站管理系统下载优化英语
  • 最好网站建设软文广告经典案例300大全
  • 济南建设委员会网站电子商务网站建设规划方案
  • 自己做网站一定要实名吗专注于seo顾问
  • 企业建网站开发网站优化公司上海
  • 官方网站开发关键词优化工具互点
  • 扁平化风格 网站沧州网站优化公司
  • 专业做网站联系电话链接
  • 深圳网站设计x东莞seo代理
  • 三合一网站开发黑帽seo教程
  • 网站备案能不能出现世界服务营销策略
  • 政府为什么做不好网站接app推广接单平台
  • 个人做网站的流程上海排名seo公司
  • 作文网站大全外链平台有哪些
  • 新疆生产建设兵团举报网站seo教程书籍
  • 查询网站建设湛江seo