Java Basics Tutorial Part 1 Getting Started
Java Basics Tutorial Part 1 Getting Started
L esso ns
Cod e
Free
Welcome
to Coding
Writing
and Running
Java Code
What is Coding?
Coding means to give commands to tell the computer what to do
Sample command:
System.out.println("Hey, I am coding");
Register at:
https://repl.it
Write, compile
and run code in
Java, JS, Python
and others
Repl.it: An Online Coding Environment
Commands in Java – Examples
Calculate an expression and print its value:
System.out.println(5 + 5);
Writing
Sim p l e J ava
Programs
Learn by Doing
To learn coding, you need to write code!
Watching videos gives you only knowledge
Solving the exercises, gives you experience and
practical skills
https://judge.softuni.org/Contests/Practice/Index/3250
Problem: Calculate and Print 5 * 5
Write a Java program, which:
Calculates the value of 5 * 5
Prints the result at the console
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
Solution: Square of 7 * 7 Stars
First solution:
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
Second solution:
for (int i = 0; i < 7; i++)
System.out.println("* * * * * * *");
Problem: EUR to USD Converter
Write a Java program, which converts from USD to EUR
Assume the EUR/USD rate is fixed: 1.17 USD for 1 EUR
Sample input: 5
Sample output: USD = 5.85
Solution: EUR to USD Converter
import java.util.Scanner;
Now
Do Your
Exerc i s es !
Learn by Doing
The only way you can learn coding is by practice
By writing code, a lot of code, every day
Join
… the SoftUni "Learn To Code" Community
…
…https://softuni.org
Access the Free Coding Lessons
Get Help from the Mentors
Meet the Other Learners