SlideShare a Scribd company logo
1 of 5
Download to read offline
public class Study30 {
public static void main(String[] args){
int breakNumber = 0;
int number = 2;
int i;
for (;number < 1001;number++) {
for (i=2;i<number+1;i++){
if ((number % i) == 0) {
breakNumber = i;
break;
}
}
if (number == breakNumber){
System.out.println(number);
}
}
}
}
public class Study31 {
public static void main(String[] args){
int number = 2;
for (;number < 1001;number++) {
if (isPrime(number)){
System.out.println(number);
}
}
}
private static boolean isPrime(int number){
int breakNumber = 0;
int i;
for (i=2;i<number+1;i++){
if ((number % i) == 0) {
breakNumber = i;
break;
}
}
if (number == breakNumber){
return true;
}
return false;
}
}
import java.util.*;;
public class Study32 {
public static void main(String[] args){
List<Integer> numbers = new ArrayList<Integer>();
int i;
for (i=2;i<1001;i++){
numbers.add(i);
}
numbers.forEach(number -> {
if (isPrime(number)){
System.out.println(number);
}
});
}
private static boolean isPrime(int number){
int breakNumber = 0;
int i;
for (i=2;i<number+1;i++){
if ((number % i) == 0) {
breakNumber = i;
break;
}
}
if (number == breakNumber){
return true;
}
return false;
}
}
import java.util.ArrayList;
public class Study33 {
public static void main(String[] args){
ArrayList <String> animals = new ArrayList<String>();
String dog ="dog";
String cat = "cat";
String horse = "horse";
animals.add(dog);
animals.add(cat);
animals.add(horse);
System.out.println("3件追加後の要素数は、" + animals.size() + "です");
animals.clear();
System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty()
+ "です");
animals.add(dog);
animals.add(cat);
System.out.println("0番目の要素は、”" + animals.get(0) + "です");
animals.remove(0);
System.out.println("0番目の要素は、”" + animals.get(0) + "です");
}
}import java.util.HashSet;
import java.util.Iterator;
public class Study34 {
public static void main(String[] args){
HashSet <String> animals = new HashSet<String>();
String dog ="dog";
String cat = "cat";
String horse = "horse";
animals.add(dog);
animals.add(cat);
animals.add(horse);
System.out.println("3件追加後の要素数は、" + animals.size() + "です");
animals.clear();
System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty()
+ "です");
animals.add(dog);
animals.add(cat);
boolean result = animals.add(cat);
System.out.println("同じ要素を2度格納しようとすると、" + result + "で
す");
for ( Iterator<String> it = animals.iterator();it.hasNext();){
String animal = it.next();
System.out.println(animal);
}
animals.remove(cat);
System.out.println("catを取り除いた後のsetの中身は、”" );
for ( Iterator<String> it = animals.iterator();it.hasNext();){
String animal = it.next();
System.out.println(animal);
}
}
}import java.util.TreeMap;
import java.util.Iterator;
public class Study35 {
public static void main(String[] args){
TreeMap <Integer,String> animals = new TreeMap<Integer,String>();
String dog ="dog";
String cat = "cat";
String horse = "horse";
animals.put(3,horse);
animals.put(2,cat);
animals.put(1,dog);
System.out.println("3件追加後の要素数は、" + animals.size() + "です");
for ( Iterator<Integer> it =
animals.keySet().iterator();it.hasNext();){
String animal = animals.get(it.next());
System.out.println(animal);
}
animals.clear();
System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty()
+ "です");
animals.put(1,dog);
animals.put(2,cat);
animals.put(3,horse);
System.out.println("key=2の要素は、" + animals.get(2) + "です");
for ( Iterator<Integer> it =
animals.keySet().iterator();it.hasNext();){
String animal = animals.get(it.next());
System.out.println(animal);
}
animals.remove(2);
System.out.println("key=2を取り除いた後のmapの中身は、" );
for ( Iterator<Integer> it =
animals.keySet().iterator();it.hasNext();){
String animal = animals.get(it.next());
System.out.println(animal);
}
}
}import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
public class Study37 {
public static void main(String[] args)
throws FileNotFoundException {
BufferedReader bufferedReader = new BufferedReader(new
FileReader("test.txt"));
}
}import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Study38 {
public static void main(String[] args)
throws IOException {
BufferedReader bufferedReader;
try {
bufferedReader = new BufferedReader(new
FileReader("test.txt"));
} catch (FileNotFoundException e) {
System.out.println("ファイルが見つかりません");
}
}
}import java.io.IOException;
public class Study39 {
public static void main(String[] args)
throws IOException {
int s = System.in.read();
System.out.println(s);
}
}

More Related Content

What's hot

Cheat sheet python3
Cheat sheet python3Cheat sheet python3
Cheat sheet python3sxw2k
 
Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheetGil Cohen
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesIHTMINSTITUTE
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat SheetKarlijn Willems
 
Practice programs
Practice programsPractice programs
Practice programsAbbott
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)Alok Kumar
 
Code javascript
Code javascriptCode javascript
Code javascriptRay Ray
 
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsThe Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsBaruch Sadogursky
 
Mementopython3 english
Mementopython3 englishMementopython3 english
Mementopython3 englishssuser442080
 
Ecto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii BodarevEcto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii BodarevElixir Club
 

What's hot (18)

Cheat sheet python3
Cheat sheet python3Cheat sheet python3
Cheat sheet python3
 
Ann
AnnAnn
Ann
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
 
Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheet
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat Sheet
 
Collection Core Concept
Collection Core ConceptCollection Core Concept
Collection Core Concept
 
JDBC Core Concept
JDBC Core ConceptJDBC Core Concept
JDBC Core Concept
 
Practice programs
Practice programsPractice programs
Practice programs
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
 
Code javascript
Code javascriptCode javascript
Code javascript
 
Python Puzzlers
Python PuzzlersPython Puzzlers
Python Puzzlers
 
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsThe Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 Seasons
 
Mementopython3 english
Mementopython3 englishMementopython3 english
Mementopython3 english
 
Java file
Java fileJava file
Java file
 
JDK 8
JDK 8JDK 8
JDK 8
 
Ecto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii BodarevEcto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii Bodarev
 

Viewers also liked

JSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFEJSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFEHiroyuki Anai
 
PYNQ 祭り: Pmod のプログラミング
PYNQ 祭り: Pmod のプログラミングPYNQ 祭り: Pmod のプログラミング
PYNQ 祭り: Pmod のプログラミングryos36
 
PYNQで○○してみた!
PYNQで○○してみた!PYNQで○○してみた!
PYNQで○○してみた!aster_ism
 
E library instrukcija_15.03.2017
E library instrukcija_15.03.2017E library instrukcija_15.03.2017
E library instrukcija_15.03.2017vogu35
 
Pynqでカメラ画像をリアルタイムfastx コーナー検出
Pynqでカメラ画像をリアルタイムfastx コーナー検出Pynqでカメラ画像をリアルタイムfastx コーナー検出
Pynqでカメラ画像をリアルタイムfastx コーナー検出marsee101
 
PYNQ単体でUIを表示してみる(PYNQまつり)
PYNQ単体でUIを表示してみる(PYNQまつり)PYNQ単体でUIを表示してみる(PYNQまつり)
PYNQ単体でUIを表示してみる(PYNQまつり)Kenta IDA
 
PYNQ祭りLT todotani
PYNQ祭りLT todotaniPYNQ祭りLT todotani
PYNQ祭りLT todotaniKenshi Kamiya
 
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩technologicarts
 
3Com 1730-010-050-1.00
3Com 1730-010-050-1.003Com 1730-010-050-1.00
3Com 1730-010-050-1.00savomir
 
Jewellery Making Classes in Chennai
Jewellery Making Classes in ChennaiJewellery Making Classes in Chennai
Jewellery Making Classes in ChennaiPriyanka Menon
 

Viewers also liked (18)

Studyx5
Studyx5Studyx5
Studyx5
 
Java勉強会2017.3.17
Java勉強会2017.3.17Java勉強会2017.3.17
Java勉強会2017.3.17
 
Studyx3
Studyx3Studyx3
Studyx3
 
コード
コードコード
コード
 
JSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFEJSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFE
 
PYNQ 祭り: Pmod のプログラミング
PYNQ 祭り: Pmod のプログラミングPYNQ 祭り: Pmod のプログラミング
PYNQ 祭り: Pmod のプログラミング
 
PYNQで○○してみた!
PYNQで○○してみた!PYNQで○○してみた!
PYNQで○○してみた!
 
E library instrukcija_15.03.2017
E library instrukcija_15.03.2017E library instrukcija_15.03.2017
E library instrukcija_15.03.2017
 
PYNQ祭り
PYNQ祭りPYNQ祭り
PYNQ祭り
 
Pynqでカメラ画像をリアルタイムfastx コーナー検出
Pynqでカメラ画像をリアルタイムfastx コーナー検出Pynqでカメラ画像をリアルタイムfastx コーナー検出
Pynqでカメラ画像をリアルタイムfastx コーナー検出
 
Pynq祭り資料
Pynq祭り資料Pynq祭り資料
Pynq祭り資料
 
PYNQ単体でUIを表示してみる(PYNQまつり)
PYNQ単体でUIを表示してみる(PYNQまつり)PYNQ単体でUIを表示してみる(PYNQまつり)
PYNQ単体でUIを表示してみる(PYNQまつり)
 
PYNQ祭りLT todotani
PYNQ祭りLT todotaniPYNQ祭りLT todotani
PYNQ祭りLT todotani
 
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩
できるプログラマーを本気で育てるSwift超入門iosプログラマーへの第一歩
 
3Com 1730-010-050-1.00
3Com 1730-010-050-1.003Com 1730-010-050-1.00
3Com 1730-010-050-1.00
 
Jell bank
Jell bankJell bank
Jell bank
 
Jewellery Making Classes in Chennai
Jewellery Making Classes in ChennaiJewellery Making Classes in Chennai
Jewellery Making Classes in Chennai
 
Game world creation
Game world creationGame world creation
Game world creation
 

Similar to Studyx4

JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfRohitkumarYadav80
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfeyewatchsystems
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginnersishan0019
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtractionCharm Sasi
 
import java.util.Scanner;public class Main {private static i.pdf
import java.util.Scanner;public class Main {private static i.pdfimport java.util.Scanner;public class Main {private static i.pdf
import java.util.Scanner;public class Main {private static i.pdfstopgolook
 
merged_document_3
merged_document_3merged_document_3
merged_document_3tori hoff
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfarishmarketing21
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Sunil Kumar Gunasekaran
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Sharable_Java_Python.pdf
Sharable_Java_Python.pdfSharable_Java_Python.pdf
Sharable_Java_Python.pdfICADCMLTPC
 
Driver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdfDriver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdfanandhomeneeds
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorFedor Lavrentyev
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressionsLogan Chien
 

Similar to Studyx4 (20)

JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdf
 
Java file
Java fileJava file
Java file
 
The Art of Clean Code
The Art of Clean CodeThe Art of Clean Code
The Art of Clean Code
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtraction
 
import java.util.Scanner;public class Main {private static i.pdf
import java.util.Scanner;public class Main {private static i.pdfimport java.util.Scanner;public class Main {private static i.pdf
import java.util.Scanner;public class Main {private static i.pdf
 
merged_document_3
merged_document_3merged_document_3
merged_document_3
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
 
Utility.ppt
Utility.pptUtility.ppt
Utility.ppt
 
Java programs
Java programsJava programs
Java programs
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Sharable_Java_Python.pdf
Sharable_Java_Python.pdfSharable_Java_Python.pdf
Sharable_Java_Python.pdf
 
sorting and its types
sorting and its typessorting and its types
sorting and its types
 
Driver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdfDriver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdf
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
Google Guava
Google GuavaGoogle Guava
Google Guava
 

Recently uploaded

Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 

Recently uploaded (20)

Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 

Studyx4

  • 1. public class Study30 { public static void main(String[] args){ int breakNumber = 0; int number = 2; int i; for (;number < 1001;number++) { for (i=2;i<number+1;i++){ if ((number % i) == 0) { breakNumber = i; break; } } if (number == breakNumber){ System.out.println(number); } } } } public class Study31 { public static void main(String[] args){ int number = 2; for (;number < 1001;number++) { if (isPrime(number)){ System.out.println(number); } } } private static boolean isPrime(int number){ int breakNumber = 0; int i; for (i=2;i<number+1;i++){ if ((number % i) == 0) { breakNumber = i; break; } } if (number == breakNumber){ return true; } return false; } } import java.util.*;; public class Study32 { public static void main(String[] args){
  • 2. List<Integer> numbers = new ArrayList<Integer>(); int i; for (i=2;i<1001;i++){ numbers.add(i); } numbers.forEach(number -> { if (isPrime(number)){ System.out.println(number); } }); } private static boolean isPrime(int number){ int breakNumber = 0; int i; for (i=2;i<number+1;i++){ if ((number % i) == 0) { breakNumber = i; break; } } if (number == breakNumber){ return true; } return false; } } import java.util.ArrayList; public class Study33 { public static void main(String[] args){ ArrayList <String> animals = new ArrayList<String>(); String dog ="dog"; String cat = "cat"; String horse = "horse"; animals.add(dog); animals.add(cat); animals.add(horse); System.out.println("3件追加後の要素数は、" + animals.size() + "です"); animals.clear(); System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty() + "です"); animals.add(dog); animals.add(cat);
  • 3. System.out.println("0番目の要素は、”" + animals.get(0) + "です"); animals.remove(0); System.out.println("0番目の要素は、”" + animals.get(0) + "です"); } }import java.util.HashSet; import java.util.Iterator; public class Study34 { public static void main(String[] args){ HashSet <String> animals = new HashSet<String>(); String dog ="dog"; String cat = "cat"; String horse = "horse"; animals.add(dog); animals.add(cat); animals.add(horse); System.out.println("3件追加後の要素数は、" + animals.size() + "です"); animals.clear(); System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty() + "です"); animals.add(dog); animals.add(cat); boolean result = animals.add(cat); System.out.println("同じ要素を2度格納しようとすると、" + result + "で す"); for ( Iterator<String> it = animals.iterator();it.hasNext();){ String animal = it.next(); System.out.println(animal); } animals.remove(cat); System.out.println("catを取り除いた後のsetの中身は、”" ); for ( Iterator<String> it = animals.iterator();it.hasNext();){ String animal = it.next(); System.out.println(animal); } } }import java.util.TreeMap; import java.util.Iterator; public class Study35 { public static void main(String[] args){
  • 4. TreeMap <Integer,String> animals = new TreeMap<Integer,String>(); String dog ="dog"; String cat = "cat"; String horse = "horse"; animals.put(3,horse); animals.put(2,cat); animals.put(1,dog); System.out.println("3件追加後の要素数は、" + animals.size() + "です"); for ( Iterator<Integer> it = animals.keySet().iterator();it.hasNext();){ String animal = animals.get(it.next()); System.out.println(animal); } animals.clear(); System.out.println("clear直後のisEmptyの結果は、" + animals.isEmpty() + "です"); animals.put(1,dog); animals.put(2,cat); animals.put(3,horse); System.out.println("key=2の要素は、" + animals.get(2) + "です"); for ( Iterator<Integer> it = animals.keySet().iterator();it.hasNext();){ String animal = animals.get(it.next()); System.out.println(animal); } animals.remove(2); System.out.println("key=2を取り除いた後のmapの中身は、" ); for ( Iterator<Integer> it = animals.keySet().iterator();it.hasNext();){ String animal = animals.get(it.next()); System.out.println(animal); } } }import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; public class Study37 { public static void main(String[] args) throws FileNotFoundException { BufferedReader bufferedReader = new BufferedReader(new FileReader("test.txt")); }
  • 5. }import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class Study38 { public static void main(String[] args) throws IOException { BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new FileReader("test.txt")); } catch (FileNotFoundException e) { System.out.println("ファイルが見つかりません"); } } }import java.io.IOException; public class Study39 { public static void main(String[] args) throws IOException { int s = System.in.read(); System.out.println(s); } }