diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed99acb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.class +.DS_Store diff --git a/Class-01/HelloWorld.java b/Class-01/HelloWorld.java new file mode 100644 index 0000000..5d520d8 --- /dev/null +++ b/Class-01/HelloWorld.java @@ -0,0 +1,47 @@ + +/* + What's up? + + This is our first application, cool hunh... + All the information we are discussing here is available at: https://docs.oracle.com/javase/tutorial/getStarted/application/ + Never miss the chance of taking a look in this official documentation, they have EVERYTHING there + + It is a bit messy and complicated I KNOW, but as soon as we get used to that is better. Is not so bad after a while, trust me :) + +*/ + +/* + YEAH, we start by declaring A CLASS, we gonna call it "Hello World". + Since it needs to be callable, it is gonna be public. + + (When would you create a private class? You shouldn't bothet about it, but you can check it here: https://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html) +*/ +public class HelloWorld +{ + + /* + Here we are calling the main method, every single application in Java needs that + it is basically the sign of where our software starts and the "main" lines of code. + The compiler will be like, what can we do today? And then start checking from here, + + [From the documentation] + The modifiers public and static can be written in either order (public static or static public), + but the convention is to use public static as shown above. You can name the argument anything you want, + but most programmers choose "args" or "argv". + + The main method accepts a single argument: an array of elements of type String. + [/From the documentation] + */ + public static void main(String[] args) { + + /* + What we want here? You're right! To simply print HelloWorld in the console. + For using it, we need to call the print function which is in the System.out class + + You can use wither "print" or "println", the difference is that println adds a new line after printing. + The arguments of the class are a simple String + */ + System.out.println("Hello world"); + + } +} diff --git a/20092018/PrimitiveDataTypesCheatSheet.java b/Class-01/PrimitiveDataTypesCheatSheet.java similarity index 100% rename from 20092018/PrimitiveDataTypesCheatSheet.java rename to Class-01/PrimitiveDataTypesCheatSheet.java diff --git a/20092018/README.md b/Class-01/README.md similarity index 100% rename from 20092018/README.md rename to Class-01/README.md diff --git a/Class-01/RepetitionAndConditionalStructures.class b/Class-01/RepetitionAndConditionalStructures.class new file mode 100644 index 0000000..dbb323c Binary files /dev/null and b/Class-01/RepetitionAndConditionalStructures.class differ diff --git a/Class-01/RepetitionAndConditionalStructures.java b/Class-01/RepetitionAndConditionalStructures.java new file mode 100644 index 0000000..6e0f1e1 --- /dev/null +++ b/Class-01/RepetitionAndConditionalStructures.java @@ -0,0 +1,59 @@ +/* + The Java programming language is statically-typed, which means that all + variables must first be declared before they can be used. This involves + stating the variable's type and name. +*/ +public class RepetitionAndConditionalStructures{ + + public static void main(String[] args) { + /* + Here we have a situation where Mary and John have different number of oranges each + We would like thme to have always the same amount so we will create a while funcion for such + Nope, this is not the best way to do it, all we want is to learn the while structure + */ + + // Let's degine the initial amount of oranges + int johnOranges = 3; + int maryOranges = 10; + + // For now, WHILE john HAS LESS oranges than Mary, we give one more orange to John + while (johnOranges