Java Basics Tutorial Part 1 Getting Started
Java Basics Tutorial Part 1 Getting Started
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);
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;
▪▪ Join
… the SoftUni "Learn To Code" Community
▪ …
▪ …https://softuni.org
▪ Access the Free Coding Lessons
▪ Get Help from the Mentors
▪ Meet the Other Learners