Workshop Programming Java for Beginners ppt
Workshop Programming Java for Beginners ppt
css
1
2
3
4
Start Small, Code Big {
5
6
[Java Fundamentals]
7
8
9 < Beginners>
10
11
12
13 }
14
Java Programming
forbeginners.html workshop.css
1
2
Contents Of ‘This Template’;
3
Here’s what you’ll find in this Slidesgo template:
4 ∗ A slide structure based on a Workshop presentation, which you can easily adapt to your needs. For
more info on how to edit the template, please visit Slidesgo School or read our FAQs.
5 ∗ An assortment of graphic resources that are suitable for use in the presentation can be found in
6 the alternative resources slide.
∗ A thanks slide, which you must keep so that proper credits for our design are given.
7 ∗ A resources slide, where you’ll find links to all the elements used in the template.
∗ Instructions for use.
8 ∗ Final slides with:
∗ The fonts and colors used in the template.
9 ∗ A selection of illustrations. You can also customize and animate them as you wish with
10 the online editor. Visit Storyset to find more.
∗ More infographic resources, whose size and color can be edited.
11 ∗ Sets of customizable icons of the following themes: general, business, avatar, creative
process, education, help & support, medical, nature, performing arts, SEO & marketing, and
12 teamwork.
13 You can delete this slide when you’re done editing the presentation.
14
Programming Language
forbeginners.html workshop.css
1
2
What is an IDE? {
3 < An integrated development environment (IDE) is a
4 software application that helps programmers develop
5 software code efficiently. It increases developer productivity
6 by combining capabilities such as software editing, building,
7 testing, and packaging in an easy-to-use application.
8 >
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Basic Structure of a Java Program{
3
A Java program typically consists of classes and methods, with the main() method
4 being the starting point. The basic structure includes:
5 Package Declarations: Optional, used to organize classes.
6 Import Statements: Include external classes and libraries.
Class Definition: Defining a class that encapsulates data and methods.
7
main() Method: Where program execution begins.
8 Statements: Instructions executed by the program, within methods.
9 >
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Syntax Rules in Java{
3 Java syntax rules include:
4 Case Sensitivity: Java is case-sensitive.
5 Class Names: Should start with an uppercase letter.
Method Names: Should start with a lowercase letter.
6
File Name: The name of the file should exactly match the class name.
7
8
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Comments in Java{
3
4 Java supports single-line and multi-line comments:
5 Single-Line Comments: Start with //.
6 Multi-Line Comments: Enclosed between /* and */.
7
8
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Variables in Java{
3 In Java, variables are containers for storing data values. The rules for naming
4 variables are:
Start with a Letter, Dollar Sign, or Underscore: It's typical to begin
5 with a letter. However, $ and _ are also valid.
6 Subsequent Characters: After the first character, variable names may
7 contain letters, digits, dollar signs, or underscores.
No Java Keywords: Variable names cannot be Java keywords or reserved
8
words (like int, double, class, etc.).
9 Case Sensitivity: Java variable names are case-sensitive.
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Data Types in Java{
3
4
Java supports various data types, including:
5 Primitive Types: int, char, float, double, boolean, etc.
6 Non-Primitive Types: Classes, interfaces, arrays.
7
8
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1
2
Reserved Words in Java{
3
4 Java reserved words include:
5 Control Flow Keywords: if, else, for, while, do,
6
switch, case.
7 Access Modifiers: public, private, protected.
8
Class-Related Keywords: class, interface, extends,
9
implements.
10
Others: static, final, this, super, return.
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
Programming Language
forbeginners.html workshop.css
1
2
Basic Escape Sequences{
3
4
Escape sequences are special character combinations that
5
allow you to represent characters that are difficult to type or
6
have a special meaning within a string. In Java programming,
7
escape sequences are used to insert characters that cannot
8
be typed directly into a string. This guide will cover the
9
10
common escape sequences in Java, their usage, and provide
11
examples to illustrate their functionality.
12
13
14 }
Programming Language
forbeginners.html workshop.css
1 Placeholders{
2
3 When displaying output in Java programming, you can
4 include variable values within the output statements using
5 placeholders, also known as format specifiers. Placeholders
6 allow you to specify where and how the values of variables
7 should be inserted into the output.
8
9 In Java, the System.out.println method is commonly
10 used to print output with placeholders, providing format
11 specifiers for different data types, allowing you to
12
control the formatting of the displayed values.
13
14 }
Programming Language
forbeginners.html workshop.css
1 Example {
2
3
4
5
6
7
8
9
10
11
12
13 In the above code, we use + to concatenate strings and the
14 } String.format method to format the floating-point value
with two decimal places.
forbeginners.html workshop.css
1 Input Operations {
2
3
4 To accept user input in Java, you can use
5
the Scanner class, which is part of the
6
java.util package.
7
8
The Scanner class allows you to read
9
different types of input from the user
10
and store them in variables.
11
12
13
14 }
forbeginners.html workshop.css
1 Output Operations {
2
3 For reading other data types, you can use similar methods of
4
Scanner class:
Long Integer: long longIntVariable = scanner.nextLong();
5
Floating-Point Number (Float): float floatVariable =
6
scanner.nextFloat();
7 Double: double doubleVariable = scanner.nextDouble();
8 Character: char charVariable = scanner.next().charAt(0);
9 Boolean: boolean booleanVariable = scanner.nextBoolean();
10
11 Remember to import java.util.Scanner at the beginning of your
12 Java file to use the Scanner class.
13
14 }
forbeginners.html workshop.css
1 Conclusion{
2
Output operations are crucial for displaying information
3
4
to the user in a Java program. By using the
System.out.println() method, you can easily display output
5
to the screen or console.
6 Escape sequences are valuable tools in Java programming
7 for representing special characters within strings. They
8 allow you to include characters that may have special
9 meanings or are difficult to type directly.
10 Accepting user input is a crucial aspect of many Java
11 programs, enabling interaction with users and processing
12 dynamic data.
13 The Scanner class in Java provides a convenient way to
14 } accept different types of input from the user.
forbeginners.html workshop.css
1 Activity no. 1{
2
Write a Java program that displays the following
3
information:
4
5 Your name.
6 A message saying, "Java is case-sensitive.“
7 A statement that demonstrates the use of
8 System.out.println().
9
10 Expected Output:
11
Name: Sam Ananias Cases
12 Java is case-sensitive.
13 This is my first Java program!
14 }
Programming Language
forbeginners.html workshop.css
1 Activity no. 2{
2
Demonstrates the usage of a different escape sequence. The
3
output should display the corresponding special characters
4
and their effects. Create a code that follows the output.
5
6
Expected
7
Output:
8
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css
1 Activity no. 3{
2 Create a Java program that:
3 Prompts the user to input their name, age, and height in
4 meters.
5 Stores these values in variables of appropriate data
6 types (String, int, and float).
7 Displays the collected data with a formatted message.
8
9 Enter your name: Sam Ananias Cases
10 Expected Enter your age: 20
11 Output: Enter your height in meters: 1.75
Programming Language