From ad431ed87d45aff21ae189f0c5a37b1cf3632fae Mon Sep 17 00:00:00 2001 From: ferraricharles Date: Thu, 20 Sep 2018 10:22:06 +0200 Subject: [PATCH] first class --- 20092018/PrimitiveDataTypesCheatSheet.java | 55 +++++++++++++++ 20092018/README.md | 80 ++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 20092018/PrimitiveDataTypesCheatSheet.java create mode 100644 20092018/README.md diff --git a/20092018/PrimitiveDataTypesCheatSheet.java b/20092018/PrimitiveDataTypesCheatSheet.java new file mode 100644 index 0000000..f57f99e --- /dev/null +++ b/20092018/PrimitiveDataTypesCheatSheet.java @@ -0,0 +1,55 @@ +/* + 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 PrimitiveDataTypesCheatSheet{ + + public static void main(String[] args) { + + /* + By default, the int data type is a 32-bit signed two's complement integer, + which has a minimum value of -231 and a maximum value of 231-1. + In Java SE 8 and later, you can use the int data type to represent an + unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 232-1 + */ + int StudentsInTheClasroom; + + /* + Use this data type when you need a range of values wider than those provided by int. + The Long class also contains methods like compareUnsigned, divideUnsigned etc to support + arithmetic operations for unsigned long. + */ + long twoRaisedToMoreThanThirty; + + /* + As with the recommendations for byte and short, use a float (instead of double) + if you need to save memory in large arrays of floating point numbers. + This data type should never be used for precise values, such as currency + */ + float temperature; + + /* + For decimal values, this data type is generally the default choice. + As mentioned above, this data type should never be used for precise values, such as currency. + */ + double pi; + + /* + The boolean data type has only two possible values: true and false. + Use this data type for simple flags that track true/false conditions. + This data type represents one bit of information, but its "size" isn't something that's precisely defined. + */ + boolean pregnant = 1; + + /* + he char data type is a single 16-bit Unicode character. + It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). + */ + char gender = 'F'; + + + + } + +} diff --git a/20092018/README.md b/20092018/README.md new file mode 100644 index 0000000..5bf333f --- /dev/null +++ b/20092018/README.md @@ -0,0 +1,80 @@ +# Getting Started + +**[LECTURE MATERIAL](http://kitlei.web.elte.hu/segedanyagok/foliak/java/en-java-bsc/01basics.pdf)** +Here we have a simple HelloWorld example =) Let's go through it. + +If you are using your computer, you should first install the JVM, check how to do it on the [Official Documentation](https://www.java.com/en/download/help/download_options.xml), when installing on Windows, you may need to configure System Variables. **Java is already configured on the Lab machines**. + +## How to compile and execute using Java? + + // Compile: + javac MyClassExampleName.java + + // Execute + java MyClassExampleName + +Yes I know, you found out the amazing power of pressing tab and having the auto-complete name of the class, but it is not compiling, that's because you should not add the extension. + +### Cheatsheet for navigating on the command lines: + +#### Windows: + + # To navigate forward + CD [FOLDER_NAME] + + # To navigate back + CD.. + + # Clean the screen + CLR + + # Show the current directory + DIR + + +#### Linux/Mac: + + # To navigate forward + CD [FOLDER_NAME] + + # To navigate back + CD .. + + # Clean the screen + clear + + # Show the current directory + ls + +### Installing JDK on Windows + +[Installing:](http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html) + +[Creating Environment variables: ](https://www.mkyong.com/java/how-to-set-java_home-on-windows-10/) + + +## Exercises +This module has a HackerRank challenge, you can check it on the following page: [www.hackerrank.com/elte-basicjava-module-1](http://www.hackerrank.com/elte-basicjava-module-1) + + +## 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)