SlideShare a Scribd company logo
2011   10   3
2011   10   3
2011   10   3
public class ListEvenNumbers {
            	 public static void main(String[] args) {

            	   	   //define limit
            	   	   int limit = 50;

            	   	   System.out.println("Printing Even numbers between 1 and " + limit);

                    // i     1     50

            	   	   for(int i=1; i <= limit; i++){

            	   	   	   //                    ?      ?
                        //              P37
            	   	   	   if( i % 2 == 0) {
            	   	   	   	 System.out.print(i + " ");
            	   	   	   }


            	 	 }
            	 }
            }
            /*
            Output of List Even Numbers Java Example would be
            Printing Even numbers between 1 and 50
            2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50
            */



2011   10   3
2011   10   3
0   ->   0000   0000   ->   00
                 1   ->   0000   0001   ->   01
                 2   ->   0000   0010   ->   02
                 3   ->   0000   0011   ->   03
                 4   ->   0000   0100   ->   04
                 5   ->   0000   0101   ->   05
                 6   ->   0000   0110   ->   06
                 7   ->   0000   0111   ->   07
                 8   ->   0000   1000   ->   08
                 9   ->   0000   1001   ->   09
                10   ->   0000   1010   ->   0A
                11   ->   0000   1011   ->   0B
                12   ->   0000   1100   ->   0C
                13   ->   0000   1101   ->   0D
                14   ->   0000   1110   ->   0E
                15   ->   0000   1111   ->   0F
                16   ->   0001   0000   ->   10
2011   10   3
2011   10   3
2011   10   3
2011   10   3
2011   10   3
2011   10   3
2011   10   3
2011   10   3
public class VariablesSample {
            	   public static void main(String[] args) {
            	   	    byte b;
            	   	    short s;
            	   	    int i;
            	   	    long l;
            	   	    char c;
            	   	    float f;
            	   	    double d;

            	       	   b   =   Byte.MIN_VALUE;
            	       	   s   =   Short.MIN_VALUE;
            	       	   i   =   Integer.MIN_VALUE;
            	       	   l   =   Long.MIN_VALUE;
            	       	   c   =   (int)Character.MIN_VALUE;
            	       	   f   =   Float.MIN_VALUE;
            	       	   d   =   Double.MIN_VALUE;
            	       	
            	       	   System.out.println(b);
            	       	   System.out.println(s);
            	       	   System.out.println(i);
            	       	   System.out.println(l);
            	       	   System.out.println((int)c);
            	       	   System.out.println(f);
            	       	   System.out.println(d);
            	       }
            }




2011   10       3
2011   10   3
2011   10   3
public class BooleanSample {
            	 public static void main(String[] args) {
            	 	 boolean t = true;
            	 	 boolean f = false;
            	 	
            	 	 if( t == true ){
            	 	 	 System.out.println("t is true!");
            	 	 }else{
            	 	 	 System.out.println("t is false!");
            	 	 }
            	 	
            	 	 if( f == true ){
            	 	 	 System.out.println("f is true!");
            	 	 }else{
            	 	 	 System.out.println("f is false!");
            	 	 }
            	 	
            	 	 boolean isTtrue = ( t == true);
            	 	 System.out.println("(t == true) is " + isTtrue);
            	 }
            }

2011   10   3
2011   10   3

More Related Content

PPTX
Python Conditionals and Functions
PPTX
How the stack works(1)
PDF
Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...
PDF
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
DOCX
Alu all shift register
PDF
C++: The Cathedral and the Bizarre
DOCX
Python real time tutorial
PDF
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Python Conditionals and Functions
How the stack works(1)
Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
Alu all shift register
C++: The Cathedral and the Bizarre
Python real time tutorial
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...

What's hot (19)

PPTX
Dependent Types with Idris
PPTX
Program presentation
PDF
PPTX
Android taipei 20160225 淺談closure
PPT
Domain Redesigned
PPT
Control flow in c
PDF
Twigエクステンションの作り方
PDF
System Verilog (Tutorial -- 2X1 Multiplexer)
TXT
PDF
オレオレSecurityバンドル作っちゃいました
PPTX
Reverse Engineering: C++ "for" operator
PDF
05 1 수식과 연산자
PPT
Structure in programming in c or c++ or c# or java
PDF
Learning C programming - from lynxbee.com
PDF
Open GL Tutorial07
Dependent Types with Idris
Program presentation
Android taipei 20160225 淺談closure
Domain Redesigned
Control flow in c
Twigエクステンションの作り方
System Verilog (Tutorial -- 2X1 Multiplexer)
オレオレSecurityバンドル作っちゃいました
Reverse Engineering: C++ "for" operator
05 1 수식과 연산자
Structure in programming in c or c++ or c# or java
Learning C programming - from lynxbee.com
Open GL Tutorial07
Ad

Viewers also liked (17)

PDF
金沢高専・グローバル情報学科 科長講話 (新入生研修)
PPT
今日からはじめるセキュリティセミナ
PDF
夏期休業中の評価課題(Javaプログラミング演習)
PDF
H27/04/01 金沢高専・グローバル情報学科紹介
PDF
インタフェース - Java入門
PDF
データベース - SELECT文入門2
PDF
金沢スマホアプリコンテスト
PDF
ファイナルプレゼン
PPT
Sygnalizacja
PDF
授業資料 - ファイルシステム
PDF
データーベース - SELECT文入門
PDF
コンピュータシステムの構成とか
PDF
OS: 論理ファイル管理 - ディレクトリについて
PDF
ファイルアクセス方式 - オペレーティングシステム
PDF
ファイルとレコード
PDF
オブジェクト指向プログラミングの考え方
PDF
SQL入門 - GROUP BYとHAVING -
金沢高専・グローバル情報学科 科長講話 (新入生研修)
今日からはじめるセキュリティセミナ
夏期休業中の評価課題(Javaプログラミング演習)
H27/04/01 金沢高専・グローバル情報学科紹介
インタフェース - Java入門
データベース - SELECT文入門2
金沢スマホアプリコンテスト
ファイナルプレゼン
Sygnalizacja
授業資料 - ファイルシステム
データーベース - SELECT文入門
コンピュータシステムの構成とか
OS: 論理ファイル管理 - ディレクトリについて
ファイルアクセス方式 - オペレーティングシステム
ファイルとレコード
オブジェクト指向プログラミングの考え方
SQL入門 - GROUP BYとHAVING -
Ad

Similar to 変数の型 - Java 演習 (20)

PPTX
บทที่ 3 พื้นฐานภาษา Java
PDF
Java Simple Programs
PDF
Java Reference
PDF
Sam wd programs
KEY
Haskellで学ぶ関数型言語
DOCX
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
PDF
Flyweight
PDF
Buacm 1
PDF
Micro Blaze C Reference
PDF
Java_Programming_by_Example_6th_Edition.pdf
PPT
9 cm604.12
PPT
9 cm604.12
PPSX
PDF
Main Form Number To Word
PPSX
โปรแกรมภาษาซีเบื้องต้น
PDF
&Y tgs P kii for
PDF
Microsoft word java
PPTX
Embedded systems
PPTX
Core java
PDF
java-introduction.pdf
บทที่ 3 พื้นฐานภาษา Java
Java Simple Programs
Java Reference
Sam wd programs
Haskellで学ぶ関数型言語
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
Flyweight
Buacm 1
Micro Blaze C Reference
Java_Programming_by_Example_6th_Edition.pdf
9 cm604.12
9 cm604.12
Main Form Number To Word
โปรแกรมภาษาซีเบื้องต้น
&Y tgs P kii for
Microsoft word java
Embedded systems
Core java
java-introduction.pdf

More from 金沢工業高等専門学校 (9)

PDF
H27・11月28日 金沢高専・グローバル情報学科 入試説明会
PDF
金沢高専・新入生へのメッセージ「これからの5年間をどう過ごしますか」
PDF
本格的なプログラミングが学べる学校・金沢高専
PDF
モデリングとクラス図
PDF
Scratchをつかってプログラムの流れを説明(抜粋)
PDF
参照型 - Java入門
PDF
型変換と優先順位 - Java入門
PDF
情報処理 - CUI 入力のポイント
PDF
看護分野におけるネット活用
H27・11月28日 金沢高専・グローバル情報学科 入試説明会
金沢高専・新入生へのメッセージ「これからの5年間をどう過ごしますか」
本格的なプログラミングが学べる学校・金沢高専
モデリングとクラス図
Scratchをつかってプログラムの流れを説明(抜粋)
参照型 - Java入門
型変換と優先順位 - Java入門
情報処理 - CUI 入力のポイント
看護分野におけるネット活用

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Types and Its function , kingdom of life
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
master seminar digital applications in india
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Insiders guide to clinical Medicine.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Complications of Minimal Access Surgery at WLH
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial diseases, their pathogenesis and prophylaxis
Cell Types and Its function , kingdom of life
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Renaissance Architecture: A Journey from Faith to Humanism
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
master seminar digital applications in india
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Week 4 Term 3 Study Techniques revisited.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Cell Structure & Organelles in detailed.
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
102 student loan defaulters named and shamed – Is someone you know on the list?
Insiders guide to clinical Medicine.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
TR - Agricultural Crops Production NC III.pdf
Complications of Minimal Access Surgery at WLH

変数の型 - Java 演習

  • 1. 2011 10 3
  • 2. 2011 10 3
  • 3. 2011 10 3
  • 4. public class ListEvenNumbers { public static void main(String[] args) { //define limit int limit = 50; System.out.println("Printing Even numbers between 1 and " + limit); // i 1 50 for(int i=1; i <= limit; i++){ // ? ? // P37 if( i % 2 == 0) { System.out.print(i + " "); } } } } /* Output of List Even Numbers Java Example would be Printing Even numbers between 1 and 50 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 */ 2011 10 3
  • 5. 2011 10 3
  • 6. 0 -> 0000 0000 -> 00 1 -> 0000 0001 -> 01 2 -> 0000 0010 -> 02 3 -> 0000 0011 -> 03 4 -> 0000 0100 -> 04 5 -> 0000 0101 -> 05 6 -> 0000 0110 -> 06 7 -> 0000 0111 -> 07 8 -> 0000 1000 -> 08 9 -> 0000 1001 -> 09 10 -> 0000 1010 -> 0A 11 -> 0000 1011 -> 0B 12 -> 0000 1100 -> 0C 13 -> 0000 1101 -> 0D 14 -> 0000 1110 -> 0E 15 -> 0000 1111 -> 0F 16 -> 0001 0000 -> 10 2011 10 3
  • 7. 2011 10 3
  • 8. 2011 10 3
  • 9. 2011 10 3
  • 10. 2011 10 3
  • 11. 2011 10 3
  • 12. 2011 10 3
  • 13. 2011 10 3
  • 14. public class VariablesSample { public static void main(String[] args) { byte b; short s; int i; long l; char c; float f; double d; b = Byte.MIN_VALUE; s = Short.MIN_VALUE; i = Integer.MIN_VALUE; l = Long.MIN_VALUE; c = (int)Character.MIN_VALUE; f = Float.MIN_VALUE; d = Double.MIN_VALUE; System.out.println(b); System.out.println(s); System.out.println(i); System.out.println(l); System.out.println((int)c); System.out.println(f); System.out.println(d); } } 2011 10 3
  • 15. 2011 10 3
  • 16. 2011 10 3
  • 17. public class BooleanSample { public static void main(String[] args) { boolean t = true; boolean f = false; if( t == true ){ System.out.println("t is true!"); }else{ System.out.println("t is false!"); } if( f == true ){ System.out.println("f is true!"); }else{ System.out.println("f is false!"); } boolean isTtrue = ( t == true); System.out.println("(t == true) is " + isTtrue); } } 2011 10 3
  • 18. 2011 10 3