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
<!-- saved from url=(0046)http://127.0.0.1:58389/Take%20Lesson/blog.html --> | |
<html data-brackets-id="1237"><head data-brackets-id="1238"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<script data-brackets-id="1239" type="text/javascript" src="./girlFriend_files/jquery.min.js"></script> | |
<link data-brackets-id="1240" href="./girlFriend_files/css" rel="stylesheet" type="text/css"> | |
<title data-brackets-id="1241">Dai Kawai</title> | |
<style data-brackets-id="1242"> | |
a{ | |
text-decoration: none; | |
} |
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
#gemfileにacts_as_followerを追加して、bundleします。 | |
source 'https://rubygems.org' | |
gem "acts_as_follower" | |
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
/* | |
Inputメソッドを使って、挨拶プログラムを作成する | |
*/ | |
package pass01; // プログラムが含まれるパッケージ名を示す。 | |
import lib.Input; //Input.javaをインポートする。インポート文。ほかのクラスを利用したいときは、パッケージ名+クラス名を記入する | |
public class Pass01_01 { // クラスの名前を宣言 {はブロック | |
public static void main(String[] args) { // メソッドを示す.これは特別なmainメソッド |
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
/* | |
Inputメソッドを使って、挨拶プログラムを作成する | |
*/ | |
package pass01; | |
import lib.Input; | |
public class Pass01_01 { // クラスの名前を宣言 {はブロック | |
public static void main(String[] args) { |
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
/* | |
Inputメソッドを使って、挨拶プログラムを作成する | |
*/ | |
package pass01; | |
import lib.Input; | |
public class Pass01_01 { // クラスの名前を宣言 {はブロック | |
public static void main(String[] args) { |
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
package pass01; | |
import lib.Input; | |
public class Pass01_01 { | |
/* メソッドのオーバーロードについて | |
* 同じ名前のメソッドは使えない | |
* ただし、引数、データ型が違えば同じ名前でもOK | |
* 今回は、正三角形、直角三角形、普通の三角形の面積を求めるプログラムを作成する | |
*/ | |
public static void main(String[] args) { |
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
package pass01; | |
import lib.Input; | |
public class Pass01_01 { | |
/*複数のメソッドを持つクラス | |
* 過去の経験人数を入力すると、からヤリチン、かろうじて非童貞、童貞にランク付けしてくれるシステム | |
*/ | |
public static void main(String[] args) { |
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
package pass01; | |
import lib.Input; | |
public class Pass01_01 { | |
/* | |
* オブジェクト指向(P288) | |
* 部品化、規格化 | |
* 汎用システムができる | |
* オブジェクト=対象 |
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
/******************************Dice.java*************************************************/ | |
package pass01; | |
public class Dice { //Diceクラス | |
int val;//フィールド変数 | |
public void play(){ | |
val = (int)(Math.random()*6)+1; //1~6のどれかを代入する | |
} //インスタンスメソッド | |
} |
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
/******************Dice.java********************* */ | |
package pass01; | |
/******************Dice.java********************* */ | |
package pass01; | |
public class Dice { //Diceクラス | |
int val;//フィールド変数 | |
//コンストラクタの設定 | |
public Dice(int val){ // numは初期値に設定したい値 |
OlderNewer