-
Notifications
You must be signed in to change notification settings - Fork 2
Tag 02 Programmierung Day 2
A Java switch case is like a multi-nested if statement. It's a jump instruction based on fixed values.
switch(i) {
// after the : comes what has to happen
case 1:
System.out.println("a");
break;
case 2:
System.out.println("c");
break;
//and so on..
//otherwise this happens
default:
System.out.println("z");
break;
}
Example: Write a code that tells you the menu of cafeteria based on the weekday.
int weekday = 1;
switch (weekday) {
case 1:
System.out.println ("Today we have ravioli.");
break;
case 2:
System.out.println ("Today we have spinach soup");
break;
//and so on
default:
System.out.println ("Unfortunately, the cafeteria is closed today and there is nothing to eat.");
break;
}
The servers on which software developers work mostly do not have a graphical user interface. Most software runs on a server and most servers run Linux. As a developer, you must therefore be able to operate Linux in the terminal.
Unix Syntax
<command> -- <option> <parameter>
lscd path/to/somethingcd ...-
touchcreates an empty file -
echo "Hello" >> text.txtcreates a new file text.txt with the entry "Hello" mkdir my-folderrm -rf my-folder-
pwdprint working directory, it's the directory in which the user is currently working in -
mv /home/user/text.txt /destination/moves text.txt from source folder to a destination folder -
mv text.txt text2.txtrenames text.txt into test2.txt
A script is a file containing a sequence of commands that you can run to save you from constantly typing.
****editors:
vim script.sh (opens script.sh with editor vim) nano script.sh (opens script.sh with editor nano)
Machen es möglich, einmal geschriebenen Code mehrfach zu verwenden und ihn zu strukturieren.
Tool zur Versionierung, das kolaboratives Coding ermöglicht.
-
Code automatisch formatieren: Opt + Cmd + L
-
System.out.println: sout + Enter -
public static void main(String[] args): main oder psvm + Enter -
Cmd + D: Duplicate Codeline
-
Shift + Opt + Arrow Up : Move Codeline
-
Cmd + N: Generate Code
-
Opt + Shift + 7 : Backslash
-
Opt + Shift + 4 : Auswahlwerkzeug für Screenshot