-
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
8f9efd5
commit ad431ed
Showing
2 changed files
with
135 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,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'; | ||
|
||
|
||
|
||
} | ||
|
||
} |
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,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) |