commit 63ba32bb3c26c337698a67c11d10ce49b52db2a2 Author: LinlyBoi Date: Sat Nov 6 23:35:03 2021 +0200 first commit diff --git a/BoringWindow.java b/BoringWindow.java new file mode 100644 index 0000000..38faabd --- /dev/null +++ b/BoringWindow.java @@ -0,0 +1,12 @@ +import javax.swing.*; + +public class BoringWindow extends JFrame +{ + public static void main ( String[] args) + { + JFrame f = new BoringWindow(); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setSize(690,420); + f.setVisible(true); + } +} \ No newline at end of file diff --git a/Constructor.java b/Constructor.java new file mode 100644 index 0000000..9431bd8 --- /dev/null +++ b/Constructor.java @@ -0,0 +1,22 @@ +class Scratch //name class sth else lol depending on usage +{ + public static void main(String[] args) { + + } + public static class Constructor + { + String material; + int height; + double width; + Constructor(String material, int height, double width) //name self-explanatory + { + this.material = material; + this.height = height; + this.width = width; + void build();{ + System.out.println("Building a house out of "+this.material + "that is " +this.height + " high and " + this.width + " wide" ); + } + } + //they can also be overloaded! f + } +} \ No newline at end of file diff --git a/IfStatements.java b/IfStatements.java new file mode 100644 index 0000000..a1ca772 --- /dev/null +++ b/IfStatements.java @@ -0,0 +1,14 @@ +import javax.swing.JOptionPane; +class Scratch { + public static void main(String[] args) { + int age = Integer.parseInt(JOptionPane.showInputDialog("How old are you?")); + if(age>=18) + { + JOptionPane.showMessageDialog(null,"You can do the fuck"); + } + + else { + JOptionPane.showMessageDialog(null,"No no no No FUCKING!!!"); + } + } +} \ No newline at end of file diff --git a/Magic8Ball.java b/Magic8Ball.java new file mode 100644 index 0000000..074066c --- /dev/null +++ b/Magic8Ball.java @@ -0,0 +1,48 @@ +import javax.swing.*; +import java.util.Random; + +public class Magic8Ball +{ + public static void main ( String[] args ) + { + Random r = new Random(); + + int choice = 1 + r.nextInt(15); + String response; + + if ( choice == 1 ) + response = "It is certain"; + else if ( choice == 2 ) + response = "It is decidedly so"; + else if ( choice == 3 ) + response = "Without a doubt"; + else if ( choice == 4 ) + response = "Yes - definitely"; + else if ( choice == 5 ) + response = "You may rely on it"; + else if ( choice == 6 ) + response = "As I see it, yes"; + else if ( choice == 7 ) + response = "Most likely"; + else if ( choice == 8 ) + response = "Outlook good"; + else if ( choice == 9 ) + response = "Signs point to yes"; + else if ( choice == 10 ) + response = "Yes"; + else if ( choice == 11 ) + response = "Reply hazy, try again"; + else if ( choice == 12 ) + response = "Ask again later"; + else if ( choice == 13 ) + response = "Better not tell you now"; + else if ( choice == 14 ) + response = "Cannot predict now"; + else if ( choice == 15 ) + response = "Concentrate and ask again"; + else + response = "8-BALL ERROR!"; + + JOptionPane.showMessageDialog(null, response); + } +} \ No newline at end of file diff --git a/MathClassTest.java b/MathClassTest.java new file mode 100644 index 0000000..0bbd25a --- /dev/null +++ b/MathClassTest.java @@ -0,0 +1,62 @@ +import java.util.ArrayList; + +class Scratch { + public static void main(String[] args) { + //double x = 10; + //double y = 20; + //double z = x+y; + + // Array + String[] noobs = {"Ggsleeb", "Glabnab", "Galanbees","Gegelfar","Gighalara"}; + System.out.println("The element is " +noobs[0]); //start from 0 :D + + //Print Array with foreach + for (String x : noobs) + { + System.out.println(x); + } + + //2D arrays POG + String[] [] noobs2 = new String [3][3]; + noobs2[0][0]= "Roosya"; + noobs2[0][1]= "GGsya"; + noobs2[0][2]= "Glabnab"; + noobs2[1][0]= "KhaledHn1"; + noobs2[1][1]= "Embty"; + noobs2[1][2]= "Noob"; + + //print 2D array with for loop :D + + for(int i=0;i food = new ArrayList(); + + food.add("Pasta"); + food.add("Pizza"); + food.add("Rice"); + + //print with for statement yes + + for(int y=0;y System.out.println("Lord Ggsleeb"); + case "KhaledHn1" -> System.out.println("Lord Gigalara"); + case "Roosya" -> System.out.println("Lord Galanbees"); + default -> System.out.println("noob not found"); + } + + + + + } +} \ No newline at end of file diff --git a/TestingMethods.java b/TestingMethods.java new file mode 100644 index 0000000..5fb8180 --- /dev/null +++ b/TestingMethods.java @@ -0,0 +1,12 @@ +class Scratch { + public static void main(String[] args) + { + + } + + + static void listnames(String a, String b, String c) + { + + } +} \ No newline at end of file diff --git a/TryCatch.java b/TryCatch.java new file mode 100644 index 0000000..fac6fe5 --- /dev/null +++ b/TryCatch.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +class TryCatch +{ + public static void main(String[] args) { + //lets divide by 0 LOL + try { + Scanner scanner = new Scanner(System.in); + System.out.println("Enter a number to divide:"); + int x = scanner.nextInt(); + + System.out.println("Enter a number to divide by:"); + int y = scanner.nextInt(); + int z = x/y; + } + catch(ArithmeticException e) + { + System.out.println("1 over zero equals infinity -Ggsya"); + } + } +} \ No newline at end of file diff --git a/WhileDo.java b/WhileDo.java new file mode 100644 index 0000000..085e1c9 --- /dev/null +++ b/WhileDo.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +class Scratch { + public static void main(String[] args) { + String name; + Scanner scanner = new Scanner(System.in); + do { + System.out.print("What is your name? \n"); + name = scanner.nextLine(); + } while(name.isBlank()); + /* can do the same with while first and without do + but that doesn't assure that the code runs at least once. */ + System.out.println("Hello "+name); + //This is a for loop now + for(int i=10;i>=1;) { + System.out.println(i); + i--; + } + System.out.println("no more numbers!"); //Is for limited amounts of times pOG + } +} \ No newline at end of file diff --git a/art.txt b/art.txt new file mode 100644 index 0000000..ebc444c --- /dev/null +++ b/art.txt @@ -0,0 +1,21 @@ + .--..--..--..--..--..--. + .' \ (`._ (_) _ \ + .' | '._) (_) | + \ _.')\ .----..---. / + |(_.' | / .-\-. \ | + \ 0| | ( O| O) | o| + | _ | .--.____.'._.-. | + \ (_) | o -` .-` | + | \ |`-._ _ _ _ _\ / + \ | | `. |_||_| | + | o | \_ \ | -. .-. + |.-. \ `--..-' O | `.`-' .' + _.' .' | `-.-' /-.__ ' .-' +.' `-.` '.|='=.='=.='=.='=|._/_ `-'.' +`-._ `. |________/\_____| `-.' + .' ).| '=' '='\/ '=' | + `._.` '---------------' + //___\ //___\ + || || + ||_.-. ||_.-. + (_.--__) (_.--__) diff --git a/audio.java b/audio.java new file mode 100644 index 0000000..9097b11 --- /dev/null +++ b/audio.java @@ -0,0 +1,38 @@ +import javax.sound.sampled.*; +import java.io.*; +import java.util.Scanner; +class Scratch +{ + public static void main(String[] args) throws UnsupportedAudioFileException,IOException, LineUnavailableException + { + Scanner scanner = new Scanner(System.in); + File file = new File("JansiFart3.wav"); + AudioInputStream audioStream = AudioSystem.getAudioInputStream(file); + Clip clip = AudioSystem.getClip(); + clip.open(audioStream); + String response = "pog"; + while(!response.equals("Q")) + { + System.out.println("P = play , S = stop , R = reset, Q = quit"); + System.out.print("Enter your choice:"); + response = scanner.next(); + response = response.toUpperCase(); + switch(response) + { + case ("P"): clip.start(); + break; + case("S"): clip.stop(); + break; + case("R"): clip.setMicrosecondPosition(0); + case("Q"): clip.close(); + break; + default: System.out.println("Not valid!"); + + } + clip.start(); +} +} + + +} + diff --git a/deleteme.txt b/deleteme.txt new file mode 100644 index 0000000..e69de29 diff --git a/fart/JansiFart3.wav b/fart/JansiFart3.wav new file mode 100644 index 0000000..cd3f5d8 Binary files /dev/null and b/fart/JansiFart3.wav differ diff --git a/fart/Scratch.class b/fart/Scratch.class new file mode 100644 index 0000000..9a9426f Binary files /dev/null and b/fart/Scratch.class differ diff --git a/fart/fart.java b/fart/fart.java new file mode 100644 index 0000000..aa40511 --- /dev/null +++ b/fart/fart.java @@ -0,0 +1,21 @@ +import javax.sound.sampled.*; +import java.io.*; +import java.util.Scanner; +class Scratch +{ + public static void main(String[] args) throws UnsupportedAudioFileException,IOException, LineUnavailableException + { + Scanner scanner = new Scanner(System.in); + File file = new File("JansiFart3.wav"); + AudioInputStream audioStream = AudioSystem.getAudioInputStream(file); + Clip clip = AudioSystem.getClip(); + clip.open(audioStream); + String response = "pog"; + clip.start(); + scanner.next(); +} +} + + + + diff --git a/file.java b/file.java new file mode 100644 index 0000000..55b8206 --- /dev/null +++ b/file.java @@ -0,0 +1,15 @@ +import java.io.File; +class Scratch { + public static void main(String[] args) + { + File file = new File("ggsleeb_wisdom.txt"); + if(file.exists()) + { + System.out.println("File exists O:"); + System.out.println(file.getPath()); + System.out.println(file.getAbsolutePath()); + } + + } +} + diff --git a/filereader.java b/filereader.java new file mode 100644 index 0000000..54b1863 --- /dev/null +++ b/filereader.java @@ -0,0 +1,29 @@ +import java.io.FileReader; +import java.io.IOException; +import java.io.FileNotFoundException; +class Scratch +{ +public static void main(String[] args) +{ + try + { + FileReader reader = new FileReader("art.txt"); + int data = reader.read(); + while(data != -1) + { + System.out.print((char)data); + data = reader.read(); + } + reader.close(); + + } + catch(FileNotFoundException e) + { + e.printStackTrace(); + } + catch(IOException e) { + + e.printStackTrace(); + } +} +} diff --git a/filewriter.java b/filewriter.java new file mode 100644 index 0000000..7839afc --- /dev/null +++ b/filewriter.java @@ -0,0 +1,20 @@ +import java.io.FileWriter; +import java.io.IOException; +import java.util.Scanner; +class Scratch { + public static void main(String[] args) + { + Scanner scanner = new Scanner(System.in); + try + { + FileWriter writer = new FileWriter("wisdom.txt"); + System.out.println("Enter wisdom pls :D"); + writer.append("\n"+scanner.nextLine()); + writer.close(); + } + catch(IOException e) + { + e.printStackTrace(); + } + } +} diff --git a/ggsleeb_wisdom.txt b/ggsleeb_wisdom.txt new file mode 100644 index 0000000..e69de29 diff --git a/guiexample.java b/guiexample.java new file mode 100644 index 0000000..f6afc4d --- /dev/null +++ b/guiexample.java @@ -0,0 +1,9 @@ +import javax.swing.JOptionPane; +class Scratch { + public static void main(String[] args) { + String name = JOptionPane.showInputDialog("What is your name?"); + JOptionPane.showMessageDialog(null,"Hello "+name); + int age = Integer.parseInt(JOptionPane.showInputDialog("Enter your mental age")); + JOptionPane.showMessageDialog(null,"Your mental age is "+age); + } +} \ No newline at end of file diff --git a/printf.java b/printf.java new file mode 100644 index 0000000..1da7b45 --- /dev/null +++ b/printf.java @@ -0,0 +1,7 @@ +class Scratch { + public static void main(String[] args) { + // printf method is for formatting things? + System.out.printf("Epic moment number %d",69); //%d represents decimal + // it is % [flags] [precision] [width] [conversion character] + } +} \ No newline at end of file diff --git a/wisdom.txt b/wisdom.txt new file mode 100644 index 0000000..c07a065 --- /dev/null +++ b/wisdom.txt @@ -0,0 +1,2 @@ + +Yes I am