Frequently asked to interview the knowledge

.Oracle a common function
length (x) returns the length of the X
converting lower (x) X lowercase
upper (x) X uppercase
substr (X, start [, length ]) Returns string X, starting from the start, intercept length characters, the default length, the default to the end of
the blank default assignment --nvl
SELECT NVL (field, 1) from table t

II. Various types of conversion

1.Map turn String

String name = String.valueOf(map.get("name"));

Map turn int

int age = Integer.valueOf("12");

2.map turn Integer

Numbers.IntegerOf(map2.get("yf"))

3.int turn String

 1.String str = Integer.toString(i);
 2.String s = String.valueOf(i);
 3.String s = "" + i;

4.String turn int

int i = Integer.valueOf(str).intValue();

Three: equals () and ==, except that equals compares the contents are equal, the comparison is == variable address reference equality.

 1 package com.de.test;
 2 
 3 public class StringA {
 4     public static void main(String[] args){
 5         String s1 = "hello";
 6         String s2 = "hello";
 7         String s3 = new String("hello");
 8         String s4 = new String("hello");
 9         System.out.println("s1:" + s1);
10         System.out.println("s2:" + s2);
11         System.out.println("s3:" +S3);
 12 is          System.out.println ( "S4:" + S4);
 13 is          System.out.println ( "---------- ---------- Comparative contents are equal ----- " );
 14          System.out.println (s1.equals (S2));
 15          System.out.println (s2.equals (S3));
 16          System.out.println (s3.equals (S4 ));
 . 17          System.out.println ( "reference address equality comparison ---------- ---------------" );
 18 is          System.out.println (== S1 S2);
 . 19          System.out.println (== S2 S3);
 20 is          System.out.println (== S3 S4);
 21 is      }
 22 is }

Performing the above code produces the following results

. 1  S1: Hello
 2  S2: Hello
 . 3  S3: Hello
 . 4  S4: Hello
 . 5 ---------- compare the contents are equal ---------------
 . 6  to true 
. 7  to true 
. 8  to true 
. 9 ---------- whether the addresses match, the comparison reference ---------------
 10  to true 
. 11  to false 
12 is  to false

Address reprint https://www.cnblogs.com/yiyidajiaoya/p/8316883.html

Guess you like

Origin www.cnblogs.com/lidar/p/11325392.html