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

PDF
PDF
DOCX
QA Auotmation Java programs,theory
PPT
Oop lecture9 13
PDF
Sam wd programs
DOCX
Raiz cuadrada
PDF
Python_ 3 CheatSheet
PDF
Python 2.5 reference card (2009)
QA Auotmation Java programs,theory
Oop lecture9 13
Sam wd programs
Raiz cuadrada
Python_ 3 CheatSheet
Python 2.5 reference card (2009)

What's hot (18)

PDF
Cheat sheet python3
DOCX
PDF
DCN Practical
PDF
Python3 cheatsheet
PDF
Core java pract_sem iii
PPTX
Python PCEP Tuples and Dictionaries
PDF
Python For Data Science Cheat Sheet
PPT
Collection Core Concept
PPT
JDBC Core Concept
PDF
Practice programs
PDF
Important java programs(collection+file)
TXT
Code javascript
PDF
Python Puzzlers
PPTX
The Groovy Puzzlers – The Complete 01 and 02 Seasons
PDF
Mementopython3 english
DOCX
Java file
PPTX
PDF
Ecto DSL Introduction - Yurii Bodarev
Cheat sheet python3
DCN Practical
Python3 cheatsheet
Core java pract_sem iii
Python PCEP Tuples and Dictionaries
Python For Data Science Cheat Sheet
Collection Core Concept
JDBC Core Concept
Practice programs
Important java programs(collection+file)
Code javascript
Python Puzzlers
The Groovy Puzzlers – The Complete 01 and 02 Seasons
Mementopython3 english
Java file
Ecto DSL Introduction - Yurii Bodarev
Ad

Viewers also liked (18)

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

Similar to Studyx4 (7)

PDF
6. Generics. Collections. Streams
PDF
Property Based Testing with ScalaCheck
PDF
Hello need help on this lab- what you need to do is add a code to Arra.pdf
KEY
Haskellで学ぶ関数型言語
PDF
package ADTs public interface CollectionADTltTgt .pdf
PDF
( PLEASE SHOW HOW TO IMPLEMENT THE DELETION FUNCTION )SAMPLE OUTPU.pdf
PDF
Animal.javapublic abstract class Animal {    private int hunger;.pdf
6. Generics. Collections. Streams
Property Based Testing with ScalaCheck
Hello need help on this lab- what you need to do is add a code to Arra.pdf
Haskellで学ぶ関数型言語
package ADTs public interface CollectionADTltTgt .pdf
( PLEASE SHOW HOW TO IMPLEMENT THE DELETION FUNCTION )SAMPLE OUTPU.pdf
Animal.javapublic abstract class Animal {    private int hunger;.pdf

Recently uploaded (20)

DOCX
An investigation of the use of recycled crumb rubber as a partial replacement...
PPTX
Software-Development-Life-Cycle-SDLC.pptx
PDF
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
PDF
IAE-V2500 Engine for Airbus Family 319/320
PDF
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
PDF
Mechanics of materials week 2 rajeshwari
PPTX
IOP Unit 1.pptx for btech 1st year students
PDF
IAE-V2500 Engine Airbus Family A319/320
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PDF
B461227.pdf American Journal of Multidisciplinary Research and Review
PPTX
Solar energy pdf of gitam songa hemant k
PDF
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
PDF
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
PPTX
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
PPTX
Soft Skills Unit 2 Listening Speaking Reading Writing.pptx
PPTX
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
PDF
Introduction to Machine Learning -Basic concepts,Models and Description
PDF
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
An investigation of the use of recycled crumb rubber as a partial replacement...
Software-Development-Life-Cycle-SDLC.pptx
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
IAE-V2500 Engine for Airbus Family 319/320
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
Mechanics of materials week 2 rajeshwari
IOP Unit 1.pptx for btech 1st year students
IAE-V2500 Engine Airbus Family A319/320
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
B461227.pdf American Journal of Multidisciplinary Research and Review
Solar energy pdf of gitam songa hemant k
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
Soft Skills Unit 2 Listening Speaking Reading Writing.pptx
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
Introduction to Machine Learning -Basic concepts,Models and Description
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt

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); } }