脚本宝典收集整理的这篇文章主要介绍了

Java – Basics

脚本宝典小编觉得挺不错的,现在分享给大家,也给大家做个参考,希望能帮助你少写一行代码,多一份安全和惬意。

Explanation of Terms

  • In-Place Algorithm(原地算法): an in-place algorithm is an algorithm which transforms input using no auxiliary data structure. However a small amount of extra storage space is allowed for auxiliary variables. The input is usually overwritten by the output as the algorithm executes. In-place algorithm updates input sequence only through replacement or swapping of elements. (Wikipedia)

Basic Knowledge

Character Class

  1. https://www.tutorialspoint.co...
  2. https://docs.oracle.com/javas...

Integer to String

  1. Convert using Integer.toString(int)
  2. Convert using String.valueOf(int)

To Declare an ArrayList with Values

For example

List<String> temp = new ArrayList<String>(Arrays.asList("1", "12"));

Iterate through a HashMap

https://stackoverflow.com/que...

If you're only interested in the keys, you can iterate through the keySet() of the map:

Map<Object, Object> map = ...;  for (Object key : map.keySet()) {     // ... }

If you only need the values, use values():

for (Object value : map.values()) {     // ... }

Finally, if you want both the key and value, use entrySet():

for (Map.Entry<Object, Object> entry : map.entrySet()) {     Object key = entry.getKey();     Object value = entry.getValue();     // ... }

Coding Test

i++ & ++i 赋值

public class test {      public static void main(String[] args) {                      int i1=0, i2=0, i3=0, i4=0, index1=0, index2=0, index3=0, index4=0;         int[] num1 = new int[10];         int[] num2 = new int[10];         int[] num3 = new int[10];         int[] num4 = new int[10];         while (index1 < 5 && index2 < 5 && index3 < 5 && index4 < 5) {             num1[index1++] = i1++;       //01234               num2[++index2] = i2++;       //001234               num3[index3++] = ++i3;       //12345             num4[++index4] = ++i4;       //012345         }         for (int n : num1) {             System.out.print(n);         }         System.out.println();         for (int n : num2) {             System.out.print(n);         }         System.out.println();         for (int n : num3) {             System.out.print(n);         }         System.out.println();         for (int n : num4) {             System.out.print(n);         }     } }  /* Output  * 0123400000  * 0012340000  * 1234500000  * 0123450000 */

要写的

  1. StringBuilder & StringBuffer
  2. Stack & Queue
  3. Hash Table & HashMap & HashSet
  4. Iterator

总结

以上是脚本宝典为你收集整理的

Java – Basics

全部内容,希望文章能够帮你解决

Java – Basics

所遇到的程序开发问题,欢迎加入QQ群277859234一起讨论学习。如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典网站推荐给程序员好友。 本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。

80%的人都看过