This file contains hidden or 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
| // redux sample | |
| function visibilityFilter(state = 'SHOW_ALL', action) { | |
| if (action.type === 'SET_VISIBILITY_FILTER') { | |
| return action.filter | |
| } else { | |
| return state | |
| } | |
| } |
This file contains hidden or 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 promiseFnA = () => { | |
| return new Promise((resolve, reject) => { | |
| reject(new Error('this is a error.')); | |
| }) | |
| .then(() => { | |
| console.log('not executed') | |
| }) | |
| // 例外を処理せず、外へ伝播させる。 | |
| .catch((error) => { | |
| throw error; |
This file contains hidden or 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
| console.log('hello world'); |
This file contains hidden or 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
| interface Engineer { | |
| void work(); | |
| } | |
| class Tester implements Engineer { | |
| void work() { System.out.println("I'm testing!"); } | |
| } | |
| class Programmer implements Engineer { |
This file contains hidden or 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
| console.log(process.argv); |
This file contains hidden or 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
| /** | |
| * | |
| * プリミティブ型は、真偽値型と数値型、文字型からなる基本的なデータ型である<br> | |
| * 数値型は用途によって必要となるサイズ、値の範囲、及び精度が異なるため、複数の種類が用意されている<br> | |
| * Javaのプリミティブ型には以下がある<br> | |
| * <br> | |
| * 数値 = {byte, short, int, long, double, float}<br> | |
| * 文字 = {char}<br> | |
| * 真偽値 = {boolean}<br> | |
| * @author k4h4shi |
This file contains hidden or 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.sql.Connection; | |
| import java.sql.DriverManager; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.sql.Statement; | |
| import java.util.Date; | |
| public class JDBCExample { | |
| // jdbc driver name and database url | |
| static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; |
This file contains hidden or 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.io.File; | |
| /** | |
| * fileクラスのサンプルです。 | |
| * @author k4h4shi | |
| * | |
| */ | |
| public class FileSample { | |
| public static void main(String[] args) { | |
| // 絶対パスによる指定(fileが存在しない場合でも、オブジェクト生成時には作成されない) |
This file contains hidden or 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 SubClass extends SuperClass { | |
| public SubClass() { | |
| super(); | |
| System.out.println("Sub constructor."); | |
| } | |
| public static void main(String[] args) { | |
| SubClass subClass = new SubClass(); // => Super constructor.¥nSub constructor. | |
| subClass.superMethod(); // => Super method. | |
| } |
This file contains hidden or 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 GenericStack<E> { | |
| private List<E> taskList; | |
| public GenericStack() { | |
| taskList = new ArrayList<>(); | |
| } | |
NewerOlder