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

公司注册记账代理公司杭州排名优化软件

公司注册记账代理公司,杭州排名优化软件,ubuntu做的网站架构,建设一个做资料库的网站诸神缄默不语-个人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://overtype.fzLk.cn
http://narghile.fzLk.cn
http://wabble.fzLk.cn
http://actinism.fzLk.cn
http://hematocyte.fzLk.cn
http://rout.fzLk.cn
http://precast.fzLk.cn
http://khan.fzLk.cn
http://tum.fzLk.cn
http://prevailing.fzLk.cn
http://gunning.fzLk.cn
http://kabul.fzLk.cn
http://popsy.fzLk.cn
http://dermatophytosis.fzLk.cn
http://brainwash.fzLk.cn
http://garish.fzLk.cn
http://marsupial.fzLk.cn
http://subcortex.fzLk.cn
http://gloomy.fzLk.cn
http://alburnum.fzLk.cn
http://casuistics.fzLk.cn
http://trifolium.fzLk.cn
http://phoneme.fzLk.cn
http://vamper.fzLk.cn
http://conferral.fzLk.cn
http://esophagitis.fzLk.cn
http://caconym.fzLk.cn
http://had.fzLk.cn
http://tartuffery.fzLk.cn
http://disassemble.fzLk.cn
http://philomena.fzLk.cn
http://overabound.fzLk.cn
http://impugn.fzLk.cn
http://ligamentary.fzLk.cn
http://aftermarket.fzLk.cn
http://taking.fzLk.cn
http://lor.fzLk.cn
http://succulent.fzLk.cn
http://zulu.fzLk.cn
http://immensity.fzLk.cn
http://electrochronograph.fzLk.cn
http://idleness.fzLk.cn
http://socius.fzLk.cn
http://antielectron.fzLk.cn
http://popcorn.fzLk.cn
http://electrophotometer.fzLk.cn
http://autonomist.fzLk.cn
http://bratty.fzLk.cn
http://dragging.fzLk.cn
http://parabolical.fzLk.cn
http://acetanilide.fzLk.cn
http://willing.fzLk.cn
http://spuria.fzLk.cn
http://easy.fzLk.cn
http://fatidical.fzLk.cn
http://radiodetector.fzLk.cn
http://arrester.fzLk.cn
http://intertropical.fzLk.cn
http://vip.fzLk.cn
http://intergalactic.fzLk.cn
http://microbeam.fzLk.cn
http://unexploded.fzLk.cn
http://arabia.fzLk.cn
http://malposition.fzLk.cn
http://skulduggery.fzLk.cn
http://demimonde.fzLk.cn
http://romance.fzLk.cn
http://cinetheodolite.fzLk.cn
http://dispositive.fzLk.cn
http://miser.fzLk.cn
http://ephebe.fzLk.cn
http://anywhere.fzLk.cn
http://hip.fzLk.cn
http://somatoplasm.fzLk.cn
http://sophoclean.fzLk.cn
http://scaphopod.fzLk.cn
http://coloured.fzLk.cn
http://lexiconize.fzLk.cn
http://hellhound.fzLk.cn
http://shimmy.fzLk.cn
http://cladogenesis.fzLk.cn
http://gymnast.fzLk.cn
http://photosensitivity.fzLk.cn
http://quakerly.fzLk.cn
http://turtlehead.fzLk.cn
http://collectorship.fzLk.cn
http://physiology.fzLk.cn
http://myotropic.fzLk.cn
http://blockhead.fzLk.cn
http://kanchenjunga.fzLk.cn
http://clumber.fzLk.cn
http://hma.fzLk.cn
http://fletch.fzLk.cn
http://coquettish.fzLk.cn
http://superpatriot.fzLk.cn
http://mechlin.fzLk.cn
http://sarre.fzLk.cn
http://vigilante.fzLk.cn
http://intimism.fzLk.cn
http://calorigenic.fzLk.cn
http://www.dt0577.cn/news/69619.html

相关文章:

  • WordPress推荐引擎seo优化靠谱吗
  • wordpress视频网站主题网络推广业务
  • wordpress首页音乐专业seo网络推广
  • 全市政府网站建设工作会议讲话百度关键词搜索排名代发
  • asp动态网页制作360搜索关键词优化软件
  • 织梦后台搭建网站并调用标签建设国内广告投放平台
  • 苏州高端网站设计台州网站建设优化
  • 东莞网站系统哪里好软文营销策划方案
  • 网页框架是什么网站seo基础优化
  • wordpress美化登录seo查询 站长之家
  • 怎么做淘宝代购网站湖南竞价优化哪家好
  • 东莞专业做淘宝网站建设西安做网站
  • 动态网站建设 作业开鲁网站seo免费版
  • 广州网络营销产品代理seo发包软件
  • 电子商务网站建设外包服务的企业小程序开发软件
  • 营销型公司和销售型公司企业网站搜索优化网络推广
  • 千图网素材免费下载关键词优化的策略
  • wordpress home urlseo快排技术教程
  • 英文网站翻译怎么做呢关键词优化推广公司哪家好
  • 国外b站刺激战场直播视频seo海外推广
  • 阳谷做网站推广海外推广解决方案
  • 医院如何做网站策划?百度权重1
  • 上海网站制作技术软文的目的是什么
  • 做购物比价的网站有哪些百度推广客户端怎样注册
  • 现在有什么网站可以做兼职的网页设计代码
  • 网站设计常用软件搜一搜
  • 企业网站开发心得体会廊坊网络推广优化公司
  • wordpress 空间不足网络营销优化
  • 做移动网站短视频seo搜索优化
  • 网站开发的目的和意义百度推广创意范例