-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad431ed
commit d31dc0b
Showing
8 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.class | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
|
||
} | ||
} |
File renamed without changes.
File renamed without changes.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<maryOranges){ | ||
// This funny instruction adds +1 to the integer, you can use the same with -- (minus) | ||
johnOranges++; | ||
|
||
/* | ||
NEW: yeap, this format thing is new for us. | ||
Read more about the format: https://docs.oracle.com/javase/tutorial/essential/io/formatting.html | ||
*/ | ||
|
||
//System.out.print("Now John has "+johnOranges+" oranges and Mary has "+maryOranges+" \n"); | ||
System.out.println("Now John has "+johnOranges+" oranges and Mary has "+maryOranges); | ||
} | ||
|
||
/* | ||
TODO:TODO TODO TODO TODO TODO TODO TODO | ||
We are not sure if the problem is Mary or John having more oranges, | ||
create a new while structure to avoid any injustice with Mary | ||
TODO:TODO TODO TODO TODO TODO TODO TODO | ||
*/ | ||
|
||
/* | ||
What about printing all the square roots of the numbers from 0 to 15? | ||
*/ | ||
// for an integer variable i, which starts equal zero, while it is lower than 15, add one | ||
// for (initialization; termination; increment); | ||
for(int i=0; i<15; i++){ | ||
double r = Math.sqrt(i); | ||
|
||
//System.out.println("The square root of "+i+" is "+r); | ||
} | ||
|
||
/* | ||
TODO:TODO TODO TODO TODO TODO TODO TODO | ||
Let's show that we can do it, and print all the square rise of the EVEN numbers | ||
TODO:TODO TODO TODO TODO TODO TODO TODO | ||
*/ | ||
|
||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Getting through commands | ||
|
||
**[LECTURE MATERIAL](http://kitlei.web.elte.hu/segedanyagok/foliak/java/en-java-bsc/01basics.pdf)** | ||
|
||
## Exercises | ||
This module has a HackerRank challenge, you can check it on the following page: [https://www.hackerrank.com/java-group-2018](https://www.hackerrank.com/java-group-2018) | ||
|
||
|
||
## Documentation regarding the examples: | ||
|
||
Data Types: | ||
* [Data Types (integer, char, float etc )](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) | ||
|
||
Loops: | ||
* [For Loop](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html) | ||
* [While and do-while loops](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html) | ||
|
||
Operators: | ||
* [Binary and Unary Operators (x+y, x*y, x++. --x etc)](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html) | ||
|
||
Functions: | ||
* [Our sweet "Sysout" functions print, println, format etc](https://docs.oracle.com/javase/tutorial/essential/io/formatting.html) | ||
|
||
Packages: | ||
* [Math](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html) | ||
* [Random](https://docs.oracle.com/javase/7/docs/api/java/util/Random.html) | ||
|
||
Arrays: | ||
* [Java Tutorial](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Classes and Objects Class | ||
|
||
**[LECTURE MATERIAL](http://kitlei.web.elte.hu/segedanyagok/foliak/java/en-java-bsc/02object-orientation.pdf)** | ||
|
||
## Recap: | ||
- If | ||
- Else | ||
- Code blocks | ||
- Static Methods | ||
|
||
|
||
## We will cover today | ||
* How to Start a Class | ||
* How to create an object | ||
* Properties and reachability | ||
|
||
|
||
|
||
## What we are going to do Today | ||
* Create a class Person | ||
* Create all the private properties to it | ||
* Create the methods setters, getters, constructor, empty constructor, equals and toString | ||
* Instantiate 3 Persons | ||
|
||
|
||
|
||
## Documentation regarding the examples: | ||
* [OOP Official Java Documentation](https://docs.oracle.com/javase/tutorial/java/concepts/) | ||
* [Class Members (once again)](https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html) |