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
| package ArrayToList; | |
| import java.util.ArrayList; | |
| /*Написать метод, который создаст список, положит в него 10 | |
| элементов, затем удалит первые два и последний, а затем выведет | |
| результат на экран.*/ | |
| import java.util.LinkedList; | |
| import java.util.List; |
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
| package ArrayToList; | |
| /*Написать метод для конвертации массива строк/чисел в список.*/ | |
| import java.util.LinkedList; | |
| import java.util.List; | |
| public class MyClass { | |
| public static void main(String [] args){ |
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
| package MatrixThread; | |
| /*Реализовать многопоточное перемножение квадратных матриц. Сравнить скорость | |
| выполнения алгоритма с однопоточным решением.*/ | |
| public class MatrixThread extends Thread{ | |
| int [][] mA; | |
| int [][] mB; | |
| int [][] mRuz; | |
| int lineNumber; |
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.concurrent.locks.Lock; | |
| import java.util.concurrent.locks.ReentrantLock; | |
| /*Решить задачу про банк: | |
| * 1. Чтобы сумма на счету оставалась не менее 100 | |
| * 2. Синхронизация осуществлялась с помощью чего-нибудь | |
| из java.util.concurrent.* Не через Atomic */ | |
| class Account { | |
| private int money; |
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
| package FileWriteTread; | |
| public class Data { | |
| static byte [] data; | |
| int j; | |
| public byte [] getData () { | |
| return data; | |
| } |
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
| package FileWriteTread; | |
| import java.io.FileNotFoundException; | |
| import java.io.IOException; | |
| import java.io.RandomAccessFile; | |
| import java.util.RandomAccess; | |
| public class FileWrite { | |
| byte [] buf; |
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
| package CopyFileThread; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileOutputStream; | |
| public class CopyFileThread { | |
| public static void copyFile(String src, String dest) throws Exception { | |
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
| package Threads; | |
| import java.util.ArrayList; | |
| public class AlotOfThread extends Thread { | |
| public void run () { | |
| System.out.println("\n2. Создать поток, который создаст 50 потоков, каждый их которых выведет на экран свой номер и дождется,\n" | |
| + " пока его прервут. Прерывание дочерних потоков должно выполнятся из потока их порождающего.\n"); | |
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
| package Counter; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Date; | |
| import java.util.Scanner; | |
| public class CounterTime extends Thread { | |
| public void run() { | |
| int x = 1; |
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
| package Recursion; | |
| /*Написать рекурсивную ф-ю для вывода на экран всех файлов и каталогов, имя которых длиннее 5 | |
| символов и вторая буква равна ‘A’. Упрощённый вариант*/ | |
| import java.io.File; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| public class Main2 { | |