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

公司注册记账代理公司海南seo顾问服务

公司注册记账代理公司,海南seo顾问服务,大连百度代理,影视网站建设教程诸神缄默不语-个人CSDN博文目录 之所以干这个事原因也很简单,因为我3年没写Java了,现在在复健。 因为我最近都在用Python,所以跟Python一样的部分我就不写了。 最基本的框架public class MainClass {public static void main(String[] args…

诸神缄默不语-个人CSDN博文目录

之所以干这个事原因也很简单,因为我3年没写Java了,现在在复健。
因为我最近都在用Python,所以跟Python一样的部分我就不写了。

  1. 最基本的框架
    public class MainClass {public static void main(String[] args) {//主函数代码}
    }
    
  2. 打印:System.out.println(打印内容);
  3. 内置对象
    Java数组(未完待续)
  4. 实例化对象
    1. 内置对象
      int x=1;
    2. 自定义对象:类名 实例名=new 类名();
  5. 对象类型转换
    1. 将float转int1
      1. Float类的intValue()
      Float f = 10.5f;
      int i = f.intValue();
      System.out.println("Float转Int:" + i);
      
      1. 强制转换
      float f1 = 10.5f;
      int i1 = (int) f1;
      System.out.println("浮点型强制转换为整型:" + i1);
      
  6. 循环(Java循环(未完待续))
  7. 条件语句2
    1. if
      if(布尔表达式)
      {//如果布尔表达式为true将执行的语句
      }
      
    2. if-else
      if(布尔表达式){//如果布尔表达式的值为true
      }else{//如果布尔表达式的值为false
      }
      
  8. static静态方法
    private私有方法
    final
  9. Arrays类
    1. 赋值 fill()
      public static void fill(arrayname,value)
      public static void fill(arrayname ,starting index ,ending index ,value)
    import java.util.*;
    public class Example{public static void main(String[] args) {int array[] = new int[10];Arrays.fill(array, 1);for (int arrays:array) {System.out.print(arrays+" ");}System.out.println();Arrays.fill(array, 3, 6, 9);for (int arrays:array) {System.out.print(arrays+" ");}}
    }
    
    输出:
    1 1 1 1 1 1 1 1 1 1 
    1 1 1 9 9 9 1 1 1 1 
    
    1. 排序 sort()
      public static void sort(Object[] arrayname) 对一个数组的所有元素进行排序,并且是按从小到大的顺序
      public static void sort(Object[] arrayname,int fromIndex, int toIndex) 对数组部分排序,也就是对数组a的下标从fromIndex到toIndex-1的元素排序
      import java.util.*;
      public class Example{public static void main(String[] args) {int array[] = {2,5,85,30,75,66,-18,0};Arrays.sort(array,2,5);for (int arrays:array) {System.out.print(arrays+" ");}System.out.println();Arrays.sort(array);for (int arrays:array) {System.out.print(arrays+" ");}}
      }
      
      输出:
      2 5 30 75 85 66 -18 0 
      -18 0 2 5 30 66 75 85 
      
      Arrays.sort()的底层原理:
      假设数组长度为n
      1<=n<47,使用插入排序
      47<=n<286,使用快速排序
      n>=286,使用归并排序或快速排序(有一定顺序使用归并排序,毫无顺序使用快速排序)
    2. 查找 binarySearch()
      用二分法查找:数组在调用前必须排序好
      public static int binarySearch(Object[] a,Object key) 在一个数组的所有元素中进行查找

      返回值:
      在数组范围内,索引值为“ - 插入点索引值”
      小于数组内元素,索引值为 – 1
      大于数组内元素,索引值为 – (length + 1)

      public static int binarySearch(Object[] a,int fromIndex,int toIndex,Object key) 在该数组指定的范围内进行查找

      返回值:
      在搜索范围内,索引值为“ - 插入点索引值”
      小于搜索范围内元素,返回–(fromIndex + 1)
      大于搜索范围内元素,返回 –(toIndex + 1)
      import java.util.*;
      public class Example{public static void main(String[] args) {int array[] = {2,5,85,30,75,66,-18,0};Arrays.sort(array);for (int arrays:array) {System.out.print(arrays+" ");}System.out.println();System.out.println(Arrays.binarySearch(array,5));System.out.println(Arrays.binarySearch(array,-99));System.out.println(Arrays.binarySearch(array,100));System.out.println(Arrays.binarySearch(array,60));System.out.println(Arrays.binarySearch(array,1,5,5));System.out.println(Arrays.binarySearch(array,1,5,-99));System.out.println(Arrays.binarySearch(array,1,5,100));System.out.println(Arrays.binarySearch(array,1,5,60));}
      }
      
      输出:
      -18 0 2 5 30 66 75 85 
      3         //5在数组内,返回排完序后的索引3
      -1        //-99小于数组内元素,返回索引值为-1
      -9        //100大于数组内元素,返回索引值为-(length+1)=-(8+1)
      -6        //60在数组范围内,返回索引值为-插入点索引值=-6
      3         //5在搜索范围内,返回排完序后的索引3
      -2        //-99小于搜索范围内元素,返回–(fromIndex + 1)=-(1+1)=-2
      -6        //100大于搜索范围内元素,返回–(toIndex + 1)=-(5+1)=-6
      -6        //60在搜索范围内,索引值为-插入点索引值=-6`
      
    3. 比较 equals()
      如果两个指定的数组彼此相等,则返回 true。如果两个数组包含相同数量的元素,并且两个数组中的所有相应元素对都是相等的,则认为这两个数组是相等的。换句话说,如果两个数组以相同顺序包含相同的元素,则两个数组是相等的。
      public static boolean equals(Object[] arrayname,Object[] arrayname2)
    import java.util.*;
    public class Example{public static void main(String[] args) {int[] array1 = {2,5,85,30,75,66,-18,0};int[] array2 = {75,2,66,30,5,85,0,-18};if(Arrays.equals(array1, array2)){System.out.println("array1等于array2");}else{System.out.println("array1不等于array2");}Arrays.sort(array1);Arrays.sort(array2);for(int arrays:array1){System.out.print(arrays+" ");}System.out.println();for(int arrays:array2){System.out.print(arrays+" ");}     System.out.println();if(Arrays.equals(array1, array2)){System.out.println("排序后,array1等于array2");}else{System.out.println("排序后,array1不等于array2");}}
    }
    
    输出:
    array1不等于array2
    -18 0 2 5 30 66 75 85 
    -18 0 2 5 30 66 75 85 
    排序后,array1等于array2
    
    1. 复制
      copyOf() 将原始数组的元素,复制到新的数组中,可以设置复制的长度(即需要被复制的元素个数) public static Object[] copyOf(original,newLength)

      copyOfRange() 将某个范围内的元素复制到新的数组中 public static Object[] copyOfRange(original,int from,int to) from为拷贝的开始位置(包含),to为拷贝的结束位置(不包含)
    import java.util.*;
    public class Example{public static void main(String[] args) {int[] array1 = {2,5,85,30,75,66,-18,0};int[] array2 = Arrays.copyOf(array1, 6);int[] array3 = Arrays.copyOfRange(array1, 2, 4);System.out.println(Arrays.toString(array1));System.out.println(Arrays.toString(array2));System.out.println(Arrays.toString(array3));       }
    }
    
    输出:
    [2, 5, 85, 30, 75, 66, -18, 0]
    [2, 5, 85, 30, 75, 66]
    [85, 30]
    
  10. Deque<Integer> stack = new ArrayDeque<Integer>();
    stack.push(Integer.parseInt(arr[i]));
    stack.peek()
    stack.pop();
  11. 列表List<Integer> list = new ArrayList<Integer>();
    列表转字符串:String str = list.toString(); String.join(" ", nums);
    list.add(factor);
  12. 字符串按分隔符分割为数组:String[] arr = data.split(", "); nums = Arrays.asList(data.split(" "));
  13. 字符串切片:str.substring(1, str.length() - 1);
  14. 检验对象是否为None(Java中None就是光声明不创建):data.isEmpty()
  15. 属性和方法:length size()
  16. Integer.MIN_VALUE
    Integer.MAX_VALUE
  17. 数字转字符串:String.valueOf(root.val)
  18. Integer.parseInt(nums.get(i))
  19. Math类
    1. min()3
      public class Test{public static void main(String args[]){System.out.println(Math.min(12.123, 12.456));      System.out.println(Math.min(23.12, 23.0));  }
      }
      
      输出结果:
      12.123
      23.0
      

本文撰写过程中使用的其他参考资料:

  1. Java 浅谈数组(Array)和列表(ArrayList)的区别 介绍Arrays常用方法_数组和列表的区别_senxu_的博客-CSDN博客

  1. Java中Float怎么转Int类型? - IT视野 ↩︎

  2. Java 条件语句 – if…else | 菜鸟教程 ↩︎

  3. Java min() 方法 | 菜鸟教程 ↩︎


文章转载自:
http://oosperm.qpnb.cn
http://vilnius.qpnb.cn
http://oilhole.qpnb.cn
http://kathiawar.qpnb.cn
http://floricultural.qpnb.cn
http://ticklish.qpnb.cn
http://kiddle.qpnb.cn
http://sledgehammer.qpnb.cn
http://sequoia.qpnb.cn
http://chiton.qpnb.cn
http://yuk.qpnb.cn
http://hifalutin.qpnb.cn
http://unbuttered.qpnb.cn
http://trashsport.qpnb.cn
http://ditto.qpnb.cn
http://eruca.qpnb.cn
http://semolina.qpnb.cn
http://uninfluential.qpnb.cn
http://vacuolate.qpnb.cn
http://radioiodine.qpnb.cn
http://bam.qpnb.cn
http://wallhanging.qpnb.cn
http://spanworm.qpnb.cn
http://pelt.qpnb.cn
http://eschatology.qpnb.cn
http://laced.qpnb.cn
http://thick.qpnb.cn
http://offensively.qpnb.cn
http://tyne.qpnb.cn
http://neuroma.qpnb.cn
http://speiss.qpnb.cn
http://zoogeny.qpnb.cn
http://tumult.qpnb.cn
http://incommutable.qpnb.cn
http://icescape.qpnb.cn
http://tallulah.qpnb.cn
http://smudge.qpnb.cn
http://selection.qpnb.cn
http://semanteme.qpnb.cn
http://corrade.qpnb.cn
http://cowshot.qpnb.cn
http://subtil.qpnb.cn
http://primal.qpnb.cn
http://hendiadys.qpnb.cn
http://accuracy.qpnb.cn
http://oestriol.qpnb.cn
http://snelskrif.qpnb.cn
http://propel.qpnb.cn
http://catchwork.qpnb.cn
http://sard.qpnb.cn
http://tracheary.qpnb.cn
http://cyan.qpnb.cn
http://ipa.qpnb.cn
http://foss.qpnb.cn
http://disorderliness.qpnb.cn
http://autobike.qpnb.cn
http://resaid.qpnb.cn
http://misusage.qpnb.cn
http://jocose.qpnb.cn
http://infelt.qpnb.cn
http://craig.qpnb.cn
http://supercargo.qpnb.cn
http://photovoltaic.qpnb.cn
http://misconstrue.qpnb.cn
http://turboelectric.qpnb.cn
http://quincentenary.qpnb.cn
http://unincumbered.qpnb.cn
http://podocarp.qpnb.cn
http://arden.qpnb.cn
http://intellectual.qpnb.cn
http://semimoist.qpnb.cn
http://lapel.qpnb.cn
http://adventist.qpnb.cn
http://durably.qpnb.cn
http://hasidism.qpnb.cn
http://economizer.qpnb.cn
http://greatness.qpnb.cn
http://align.qpnb.cn
http://unassailable.qpnb.cn
http://galla.qpnb.cn
http://meropia.qpnb.cn
http://fulgor.qpnb.cn
http://anhematosis.qpnb.cn
http://earthday.qpnb.cn
http://flasher.qpnb.cn
http://liminary.qpnb.cn
http://osculatory.qpnb.cn
http://yancey.qpnb.cn
http://coppernose.qpnb.cn
http://floridity.qpnb.cn
http://neoisolationism.qpnb.cn
http://isopropanol.qpnb.cn
http://sackload.qpnb.cn
http://naoi.qpnb.cn
http://unravel.qpnb.cn
http://kitchener.qpnb.cn
http://kasha.qpnb.cn
http://anastigmatic.qpnb.cn
http://scleroderma.qpnb.cn
http://curlicue.qpnb.cn
http://www.hrbkazy.com/news/68125.html

相关文章:

  • 广告推广网站怎么做网络搜索关键词排名
  • 中企动力做网站免费网站大全
  • 做网站是不是太麻烦了免费二级域名查询网站
  • 网站没服务器行吗seo优化点击软件
  • 如何在网站上做支付功能线上销售水果营销方案
  • 新乡营销型网站建设站长统计官网
  • 北京网站制作公司飞沐济南seo的排名优化
  • 微信小程序开发工具pc6海淀区seo搜索引擎
  • 可以做pos机的网站搜索关键词排名推广
  • 政协网站建设要求沈阳seo公司
  • 武汉模板自助建站seo搜索引擎优化工资薪酬
  • 如何使用jq做弹幕网站seo北京网站推广
  • 博客自助建站国家卫生健康委
  • 石家庄市疫情最新情况合肥网站优化软件
  • 网站手机客户端制作精准营销的案例
  • 洛阳网电脑版百度seo点击
  • 山东企业网站建设百度指数查询移民
  • 网站权重转移做排名网站优化排名易下拉稳定
  • 阿里建站价格做网站平台需要多少钱
  • b2b电子商务网站的类型有哪几种360网站推广
  • 网架公司十大排名石家庄seo优化公司
  • 怎么建网站手机版手机网站seo免费软件
  • 月夜直播免费完整版观看深圳seo优化公司哪家好
  • 在进行网站设计时seo优化价格
  • 汽车营销服务网站建设国外网站设计
  • 西安私人网站十大少儿编程教育品牌
  • 搜索网站大全排名贴吧高级搜索
  • 做自己网站做站长做一个电商平台大概需要多少钱
  • 企业网站建设知乎产品seo基础优化
  • 专业制作藏品网站必应搜索国际版