Created
April 28, 2016 17:34
-
-
Save MateuszNaKodach/55bbf8339b47ee45a8d9693a7d051268 to your computer and use it in GitHub Desktop.
My home JAVA exercises from Programmist Compendium by Herbert Schildt BOOK.
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
KompendiumProgramistyJavaCwiczeniaWydanieIX |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<resourceExtensions /> | |
<wildcardResourcePatterns> | |
<entry name="!?*.java" /> | |
<entry name="!?*.form" /> | |
<entry name="!?*.class" /> | |
<entry name="!?*.groovy" /> | |
<entry name="!?*.scala" /> | |
<entry name="!?*.flex" /> | |
<entry name="!?*.kt" /> | |
<entry name="!?*.clj" /> | |
<entry name="!?*.aj" /> | |
</wildcardResourcePatterns> | |
<annotationProcessing> | |
<profile default="true" name="Default" enabled="false"> | |
<processorPath useClasspath="true" /> | |
</profile> | |
</annotationProcessing> | |
</component> | |
</project> |
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
<component name="CopyrightManager"> | |
<settings default="" /> | |
</component> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding"> | |
<file url="PROJECT" charset="UTF-8" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="EntryPointsManager"> | |
<entry_points version="2.0" /> | |
</component> | |
<component name="MavenImportPreferences"> | |
<option name="generalSettings"> | |
<MavenGeneralSettings> | |
<option name="mavenHome" value="Bundled (Maven 3)" /> | |
</MavenGeneralSettings> | |
</option> | |
</component> | |
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> | |
<OptionsSetting value="true" id="Add" /> | |
<OptionsSetting value="true" id="Remove" /> | |
<OptionsSetting value="true" id="Checkout" /> | |
<OptionsSetting value="true" id="Update" /> | |
<OptionsSetting value="true" id="Status" /> | |
<OptionsSetting value="true" id="Edit" /> | |
<ConfirmationsSetting value="0" id="Add" /> | |
<ConfirmationsSetting value="0" id="Remove" /> | |
</component> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/KompendiumProgramistyJavaCwiczeniaWydanieIX.iml" filepath="$PROJECT_DIR$/KompendiumProgramistyJavaCwiczeniaWydanieIX.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="$PROJECT_DIR$/.." vcs="Git" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
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
2323 | |
4234134 | |
12312312 | |
542344 | |
523463 | |
563 | |
34 | |
523 | |
4 | |
324 | |
25 | |
23 | |
4 | |
4 | |
12 | |
3231231 | |
123 |
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 rozdzial13.wejscie.wyjscie.aplety; | |
import java.io.PrintWriter; | |
/** | |
* Created by Mateusz on 2016-04-28. | |
*/ | |
public class KlasaPrintWriter { | |
public static void main(String[] args) { | |
PrintWriter pw = new PrintWriter(System.out,true); | |
pw.println("To jest lancuch znakow."); | |
int i = -7; | |
pw.println(i); | |
int j = 0xDEADBEEF; | |
int k= 0xA; | |
pw.println(j); | |
pw.println(k); | |
double d = 4.5e-7; | |
pw.println(d); | |
} | |
} |
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 rozdzial13.wejscie.wyjscie.aplety; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
/** | |
* Created by Mateusz on 2016-04-28. | |
*/ | |
public class OdczytIZapisPlikow_ShowFile { | |
public static void main(String[] args) { | |
int i; | |
String fileName="TEST.TXT"; | |
FileInputStream fin; | |
try { | |
fin = new FileInputStream(fileName); | |
} catch (FileNotFoundException e) { | |
System.out.println("Podany plik nie istnieje."); | |
return; | |
} | |
//Plik otwarty i gotowy do uzycia, odczytujemy znaki: | |
try{ | |
do{ | |
i = fin.read(); | |
if(i!=-1) System.out.println((char)i); | |
}while(i!=-1); | |
}catch(IOException e){ | |
System.out.println("Błąd odczytu pliku."); | |
} | |
//zamyka plik: | |
try{ | |
fin.close(); | |
}catch(IOException e){ | |
System.out.println("Błąd zamykania pliku."); | |
} | |
} | |
} |
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 rozdzial13.wejscie.wyjscie.aplety; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
/** | |
* Created by Mateusz on 2016-04-28. | |
*/ | |
public class OdczytLancuchow { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
String str=""; | |
System.out.println("Wpisz wiersze tekstu:"); | |
do{ | |
str = br.readLine(); | |
System.out.print(str+"\t"); | |
}while(!str.equals("stop")); | |
} | |
} |
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 rozdzial13.wejscie.wyjscie.aplety; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
/** | |
* Created by Mateusz on 2016-04-27. | |
*/ | |
public class OdczytZnakowZKonsoli { | |
public static void main(String[] args) throws IOException { | |
System.out.println("SIEMA..."); | |
System.err.println("ERROR!"); | |
String c; | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
System.out.println("Wpisz znaki, wpisanie 'q' powoduje zakonczenie programu \" ."); | |
do{ | |
c = (String) br.readLine(); | |
System.out.println(c); | |
}while(!c.equals("q")); | |
} | |
} |
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 rozdzial13.wejscie.wyjscie.aplety; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
/** | |
* Created by Mateusz on 2016-04-28. | |
*/ | |
public class ProstyEdytorTekstu { | |
public static void main(String[] args) throws IOException{ | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
String str[] = new String[100]; | |
for(int i=0;i<100;i++){ | |
str[i]=br.readLine(); | |
if(str[i].equals("stop"))break; | |
} | |
//wyswietlenie tekstu: | |
for(int i=0;i<100;i++){ | |
if(str[i].equals("stop"))break; | |
System.out.println(str[i]); | |
} | |
} | |
} |
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
2323 | |
4234134 | |
12312312 | |
542344 | |
523463 | |
563 | |
34 | |
523 | |
4 | |
324 | |
25 | |
23 | |
4 | |
4 | |
12 | |
3231231 | |
123 |
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 rozdzial16; | |
/** | |
* Created by Mateusz on 2016-04-28. | |
*/ | |
public class obslugalancuchow { | |
} |
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
2323 | |
4234134 | |
12312312 | |
542344 | |
523463 | |
563 | |
34 | |
523 | |
4 | |
324 | |
25 | |
23 | |
4 | |
4 | |
12 | |
3231231 | |
123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment