This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
String str1 = "aa"; | |
String str2 = new String("aa"); // newすると別インスタンスになる | |
System.out.println(str1 == str2); // 同一インスタンスではないため、false | |
System.out.println(str1.equals(str2)); // 同値のため、true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
int[] arr = {}; | |
System.out.println(arr); // [I@15db9742 みたいなのが出力される | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main1 { | |
public static void main(String[] args) { | |
String a = null; | |
a += ""; | |
System.out.println(a instanceof String); // true | |
System.out.println(a.equals("null")); // true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
main(1, 1); // ソッド main(int, double) は型 Main1 であいまいです | |
} | |
public static void main(int i, double j) { | |
} | |
public static void main(double i, int j) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
main(1, 1); | |
} | |
public static void main(int i, double j) { // この場合、コンパイルエラーとならない | |
System.out.println("このメソッドが呼ばれる"); | |
} | |
public static void main(double i, double j) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class Main { | |
public static void main(String[] args) { | |
@SuppressWarnings("serial") | |
List<String> list = new ArrayList<String>() { | |
{ | |
get(2); // IndexOutOfBoundsExceptionが発生する | |
add("test1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signature expired: 20200219T105852Z is now earlier than 20200219T110350Z (20200219T110850Z - 5 min.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
name: 'yamada', | |
age: 17 | |
}; | |
const handler = { | |
set: function(target, prop, value) { | |
console.log(value) | |
target[prop] = value.toUpperCase() | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Data { | |
constructor() {} | |
_update() { | |
// 処理 | |
} | |
_insert() { | |
// 処理 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handlebars = require('handlebars') | |
const sentence = 'hello, {{name}}. \n{{#kids}}my name is {{name}} {{/kids}} ' | |
const template = handlebars.compile(sentence) | |
const param = { | |
name: 'takahashi', | |
kids: [{ sun: 'kodomo a' }, { sun: 'kodomo b' }] | |
} | |
const kekka = template(param) | |
console.log(kekka) |