KEMBAR78
Java Tutorial: Part 1. Getting Started | PPTX
Java Tutorial
Part 1: Getting Started
with Java Coding
Welcome
to Coding
Writing
and Running
Java Code
 Coding means to give commands to tell the computer what to do
 Sample command:
 A computer program is a sequence of commands (lines of code)
What is Coding?
System.out.println("Hey, I am coding");
System.out.println("First command");
System.out.println("Second command");
System.out.println("Third command");
Repl.it: An Online Coding Environment
Register at:
https://repl.it
Write, compile
and run code in
Java, JS, Python
and others
Repl.it: An Online Coding Environment
 Calculate an expression and print its value:
Commands in Java – Examples
System.out.println(5 + 5);
 Check if certain word contains another word
System.out.println("softuni".contains("uni"));
 Print the numbers from 1 to 100
for (int i = 1; i <= 100; i++)
System.out.println(i);
Coding
Concepts
Programming,
Commands, Code,
Algorithms, IDEs
 Programming means writing computer programs (commands)
 Using certain programming language, such as Java or Python
 Algorithm == a sequence of commands that achieves certain result
 Programming (coding) is performed by programmers (developers)
 Programmers use IDE (like IntelliJ IDEA or Eclipse or REPL.it) to:
 Write the code
 Run and test the code
 Find a fix bugs (debug the code)
Programming and Algorithms
 Sample Java program (sequence of Java commands):
Computer Program – Example
int size = 5;
System.out.println("Size = " + size);
System.out.println("Area = " + size * size);
 Sample complete Java program (class + method + commands):
Complete Computer Program
public class Main {
public static void main(String[] args) {
int size = 5;
System.out.println("Size = " + size);
System.out.println(
"Area = " + size * size);
}
}
 Java program, which converts from USD to EUR (at fixed rate)
Console-Based Java Program – Example
Scanner scanner = new Scanner(System.in);
int dollars = scanner.nextInt();
double euro = dollars * 0.883795087;
System.out.println("Euro: " + euro);
Put this line of code:
import java.util.Scanner;
before the class definition
The Judge System
Sending your Solutions
for Automated Evaluation
Testing the Program in the Judge System
 Test your code online in the SoftUni Judge system:
https://judge.softuni.org/Contests/3250
 To learn coding, you need to write code!
 Watching videos gives you only knowledge
 Solving the exercises, gives you experience and
practical skills
Learn by Doing
Write and submit the
coding exercises!
 Write a Java program, which:
 Prints "Hello Java" on the console
 Submit your solution in the SoftUni judge:
https://judge.softuni.org/Contests/Practice/Index/3250
Problem: Print "Hello Java"
Solution: Print "Hello Java"
public class Main {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}
Submission in the Judge System
https://judge.softuni.org/Contests/Practice/Index/3250
 Write a Java program, which:
 Calculates the value of 5 * 5
 Prints the result at the console
 Submit your solution in the SoftUni judge:
https://judge.softuni.org/Contests/Practice/Index/3250
Problem: Calculate and Print 5 * 5
Solution: Calculate and Print 5 * 5
public class Main {
public static void main(String[] args) {
System.out.println(5 * 5);
}
}
 Write a program to print your name at the first line and
calculate and print the expression 5 + 3 at the second line
 The expected output from your program might look like this:
 Another example of valid output:
Problem: Name and Expression
Maria
8
Peter
8
 Write a program, which calculates and prints the value of the
following expressions:
 5 + 3 * 2
 4 * (2 + 3)
 (2 + 5) * (8 - 2) / 7
Problem: Calculations
 Write a program, which:
 Prints a square of 7 * 7 stars like this:
Problem: Square of 7 * 7 Stars
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
 First solution:
 Second solution:
Solution: Square of 7 * 7 Stars
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
System.out.println("* * * * * * *");
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:
 Sample output:
5
USD = 5.85
Solution: EUR to USD Converter
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double eur = scan.nextDouble();
double usd = eur * 1.17;
System.out.println("USD = " + usd);
}
}
 The only way you can learn coding is by practice
 By writing code, a lot of code, every day
Learn by Doing
Write and submit the coding
exercises to gain experience!
 …
 …
 …
Next Steps
 Join the SoftUni "Learn To Code" Community
 Get Help from the Mentors
 Meet the Other Learners
 Get Free Coding Lessons
https://softuni.org

Java Tutorial: Part 1. Getting Started

  • 1.
    Java Tutorial Part 1:Getting Started with Java Coding
  • 2.
  • 3.
     Coding meansto give commands to tell the computer what to do  Sample command:  A computer program is a sequence of commands (lines of code) What is Coding? System.out.println("Hey, I am coding"); System.out.println("First command"); System.out.println("Second command"); System.out.println("Third command");
  • 4.
    Repl.it: An OnlineCoding Environment Register at: https://repl.it Write, compile and run code in Java, JS, Python and others
  • 5.
    Repl.it: An OnlineCoding Environment
  • 6.
     Calculate anexpression and print its value: Commands in Java – Examples System.out.println(5 + 5);  Check if certain word contains another word System.out.println("softuni".contains("uni"));  Print the numbers from 1 to 100 for (int i = 1; i <= 100; i++) System.out.println(i);
  • 7.
  • 8.
     Programming meanswriting computer programs (commands)  Using certain programming language, such as Java or Python  Algorithm == a sequence of commands that achieves certain result  Programming (coding) is performed by programmers (developers)  Programmers use IDE (like IntelliJ IDEA or Eclipse or REPL.it) to:  Write the code  Run and test the code  Find a fix bugs (debug the code) Programming and Algorithms
  • 9.
     Sample Javaprogram (sequence of Java commands): Computer Program – Example int size = 5; System.out.println("Size = " + size); System.out.println("Area = " + size * size);
  • 10.
     Sample completeJava program (class + method + commands): Complete Computer Program public class Main { public static void main(String[] args) { int size = 5; System.out.println("Size = " + size); System.out.println( "Area = " + size * size); } }
  • 11.
     Java program,which converts from USD to EUR (at fixed rate) Console-Based Java Program – Example Scanner scanner = new Scanner(System.in); int dollars = scanner.nextInt(); double euro = dollars * 0.883795087; System.out.println("Euro: " + euro); Put this line of code: import java.util.Scanner; before the class definition
  • 12.
    The Judge System Sendingyour Solutions for Automated Evaluation
  • 13.
    Testing the Programin the Judge System  Test your code online in the SoftUni Judge system: https://judge.softuni.org/Contests/3250
  • 15.
     To learncoding, you need to write code!  Watching videos gives you only knowledge  Solving the exercises, gives you experience and practical skills Learn by Doing Write and submit the coding exercises!
  • 16.
     Write aJava program, which:  Prints "Hello Java" on the console  Submit your solution in the SoftUni judge: https://judge.softuni.org/Contests/Practice/Index/3250 Problem: Print "Hello Java"
  • 17.
    Solution: Print "HelloJava" public class Main { public static void main(String[] args) { System.out.println("Hello Java"); } }
  • 18.
    Submission in theJudge System https://judge.softuni.org/Contests/Practice/Index/3250
  • 19.
     Write aJava program, which:  Calculates the value of 5 * 5  Prints the result at the console  Submit your solution in the SoftUni judge: https://judge.softuni.org/Contests/Practice/Index/3250 Problem: Calculate and Print 5 * 5
  • 20.
    Solution: Calculate andPrint 5 * 5 public class Main { public static void main(String[] args) { System.out.println(5 * 5); } }
  • 21.
     Write aprogram to print your name at the first line and calculate and print the expression 5 + 3 at the second line  The expected output from your program might look like this:  Another example of valid output: Problem: Name and Expression Maria 8 Peter 8
  • 22.
     Write aprogram, which calculates and prints the value of the following expressions:  5 + 3 * 2  4 * (2 + 3)  (2 + 5) * (8 - 2) / 7 Problem: Calculations
  • 23.
     Write aprogram, which:  Prints a square of 7 * 7 stars like this: Problem: Square of 7 * 7 Stars * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • 24.
     First solution: Second solution: Solution: Square of 7 * 7 Stars System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); System.out.println("* * * * * * *"); for (int i = 0; i < 7; i++) System.out.println("* * * * * * *");
  • 25.
    Problem: EUR toUSD 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:  Sample output: 5 USD = 5.85
  • 26.
    Solution: EUR toUSD Converter import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double eur = scan.nextDouble(); double usd = eur * 1.17; System.out.println("USD = " + usd); } }
  • 28.
     The onlyway you can learn coding is by practice  By writing code, a lot of code, every day Learn by Doing Write and submit the coding exercises to gain experience!
  • 29.
     …  … … Next Steps  Join the SoftUni "Learn To Code" Community  Get Help from the Mentors  Meet the Other Learners  Get Free Coding Lessons https://softuni.org

Editor's Notes

  • #2 Hello, I am Svetlin Nakov from SoftUni. I am an experienced software engineer and tech trainer and I love to teach beginners how to code. During the last 15 years I've helped more than one hundred thousand young people to begin coding, learn software development and start a job in the IT industry. Just Google my name and you will find more about what I do as a technical trainer. Today I am excited to start teaching programming and software technologies on a global scale for my growing "learn to code" community. Welcome to my free code lessons. The code lessons are not just video tutorials. They combine videos with practical exercises, where you write code after each lesson, and you learn by doing, by writing code, fixing bugs and learning from your mistakes. Why do you need to practice? Because coding is a skill. It cannot be learned by watching videos. That's why after each code lesson I will give you a set of practical coding exercises. I will introduce you to the automated evaluation system (the SoftUni judge), where you send your code, and the system tells you if it's correct or not. And it's free, so everyone can use it to check their skills. Today I will start with a simple tutorial for Java programming for absolute beginners. This will be the first lesson, but it is just a start. In the next few weeks, I will publish a series of Java lessons, which follow logically one after another, so if you want to learn Java coding, just follow the lessons in the correct order. In this lesson, I will explain what coding is, what are commands and what is their syntax in Java. I will show you how to write simple Java commands and Java programs. Together we will solve a few coding exercises to practice our new skills. We shall use a free online code editor called repl.it, so you need nothing more than your laptop. I recommend to use a laptop instead of a tablet or smartphone, because it works better. Finally, I will show you how to use the SoftUni Judge, our automated code evaluation system and how to submit your code for automated grading. OK, let's start. Let's begin learning Java. It's easy. Just follow my instructions.
  • #3 Welcome to coding! In this section I will explain what coding is and how to write simple commands in Java. Together, we'll write and execute a few small Java programs. We shall use the online code editor repl.it, so you will need nothing more than your laptop.
  • #8 In the next section I am going to explain you some basic programming concepts, such as coding, code commands, programming, computer programs, algorithms, programmers, software developers, and development environments (IDEs). I will demonstrate an example of a complete Java program, which holds a class definition, a method definition and a few commands inside.
  • #13 Now I want to show you the SoftUni judge system. SoftUni Judge is an automated system for code evaluation. Just send your code solution for certain coding problem and the system will tell you whether your solution is correct or not and what exactly is missing or wrong. I am sure you will love the judge system, once you start using it!
  • #15 Now, it's your turn to write code. Please, don't skip the exercises! The only way you can learn to code is by coding. Follow the exercises, which I have prepared for you in this lesson, write the code, submit it in the judge system, and you will get the practical skills from this lesson, not just the theory. Find the exercise descriptions and the link to judge at softuni.org. Are you ready to practice? I will show you how.
  • #30 Remember that the most important activity in learning how to code is "coding"! Maybe, I repeated myself several times, but it is tremendously important to do and submit your exercises and to practice what you have learned today, to develop it as a skill.
  • #32 Thank you for joining this free code lesson. I hope you have found that writing Java code is not scary and you can try it yourself. Now it's your turn. Now it's time to start coding, because to gain skills, you should practice! Solve and submit the practical exercises from the lesson. It is really, really important! Join the SoftUni global learn-to-code community at softuni.org. Register at the SoftUni Web site to get access to the exercises, the automated judge system to check your code and to our community resources. Meet your mentors and other learners. Talk to them and get help. And this is free! Yes, you can learn for free: you can access our existing and new upcoming code lessons and coding videos and tutorials for free. Just subscribe and you will get an email for each code lesson when it is published. You can get free help for any coding problem you have. Our mentors and instructors in the SoftUni community will answer any question you ask in our discussion board. Just join and ask. And this is also free. Talk to other learners like you. Share resources, ask questions, get involved, learn in a group. Learning works better when you have people together with you. Finally, subscribe to my YouTube channel to watch more videos like this and to get notifications for my new code lessons. Goodbye. See you in my next video lesson.