0% found this document useful (0 votes)
4 views19 pages

Understanding Programming Languages

java
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views19 pages

Understanding Programming Languages

java
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAMMING o Provides minute or no

abstraction form a computer’s


 The process of preparing an
instruction set architecture
instructional program for a device
o Closer to the native language of
 Attempting to get a computer a
a computer
complete a specific task without
o Directly executable on the
making mistakes
 Computer only understand machine computing hardware without any
code interpretation or translation
o A series of 1’s and 0’s fed and  High-Level programming languages
o Language which is closer to
interpreted by the computer
o Only way a computer can read human languages
o Much more user-friendly
English instructions
programming context and
PROGRAMMING LANGUAGES independent of the computer’s
 Programming languages serve as a hardware architecture
middle-man of sorts o Easier to read, write, and
 Translate your instructions into maintain
Machine code TRANSLATION OF HIGH TO LOW LANGUAGE
o The series of 0’s and 1’s that the
computer can understand  Programs written in a high-level
 Very useful for programmers language must be translated into
machine language by a compiler or
HOW LANGUAGES VARY – interpreter
 Each language is unique in how they
operate
o Java and Python – General
purpose languages
o HTML/CSS – Designed for
specific tasks (WEBPAGE
DESIGN)
 Each language also varies in how
powerful it is
o Javascript isn’t used for big
problems
o Java and Python are

HIGH VS LOW LEVEL –

 Each language also has an attribute


known as power or level
o Basically how similar it is to
machine code
 Low- Level programming languages
o Small or nonexistent amount of
abstraction between the
language
PICTURAL REPRESENTATION

 In addition to a place to write code,


IDE’s also include
o Built in Error-checking
 For when code doesn’t go
right
o Auto-fill for frequently used
 High level languages words
o Python o Project Hierarchy
o Javascript  A big step up from previously used
o Perl methods of programming
o PHP AN IDE’S LOOK
o C++
 Usually has a central area for writing
o FORTRAN
code
o Ruby
o Additional windows, such as one
o C#
for a console, project hierarchy,
o R
preview screens, etc.
o SQL  Each language has its own set of
 Assembly Language rules you must follow within an IDE
o x86 Assembly (Intel/AMD o You cant simply type rubbish in
processors) an IDE, Convert it to machine
o ARM Assembly (used in phones, code and expect the computer
Raspberry Pi) to understand it. You need
o MIPS Assembly (used in some Syntax
routers, embedded systems)
o 6502 Assembly (used in early
video game consoles like NES) LEARNING LANGUAGES
HOW DO WE WRITE CODE  Learning a computer language can be
 We use IDE’s (integrated Development very similar to learning a real
Environments) to write code language
o A place to write, run and debug o All programming languages
code and also convert it to have a set of rules you must
machine code follow when writing code in that
 IDE’s are likely any other program on language. Just like in real
your computer except used for the languages
facilitation of code  In computer science it is
o NetBeans, IntelliJ, Visual Studios called syntax
 Similar to Grammar in real life
IDE FUNCTIONALITY languages
WHAT’S SYNTAX entire context of what you are
trying to say
 Rules you must follow to a tee if you
want your program to run correctly BUILT-IN ERROR CHECKS
o How you type out certain
 Another cool thing about IDE’s is that
functions
they will let you know if and when
o What you put at the end of each
there are syntax errors in your code
line of code
o Parts of your code which do not
o How you set up certain functions
follow the rules
 Syntax for each programing languages
 Usually underlines in red like above
is unique
 Breaking programming rules will result HOW DO WE GET INFORMATION FROM
in an error COMPUTERS: CONSOLES

VARIABLE EXAMPLE  Programmers keep track of their


progress by looking at the console
 Let’s initialize a variable in java,
o A text interface within the
python, and javascript
computer that us programmers
o Variables hold information
can use for a variety of purposes
 In each we have to follow different
 The main use of the console is to
rules to complete the same task
output text from the program using
x=3 code var x = 3
o More specifically a print
Python statement Javascript
 Print txt to the console for
the programmers viewing
pleasure

 In java, specify which type of variable INFORMATION FROM COMPUTERS: USING


we are defining and also add a THE PRINT STATEMENT
semicolon at the end of the line
 To use the print statement, simply
 In python, type what we want to
instruct the console to print, and then
create
include whatever you want to be
 In JavaScript, we specify we are
printed inside the parenthesis
making a variable, don’t define what
o Using python, we can print to
type of variable
console like so
 Print statement is also used for
viewing and 'interpreting the
SYNTAX MATTERS
compute’s output from a program
 The goal of the program was the o Computing 4+3 will print
same, But all three languages shown nothing to the console
took different approaches

WHAT IF WE MESS UP?

 The entire program will not run and


send you back a syntax error
o Similar to forgetting a comma in
a sentence and messing up the
o Printing 4+3 however, will print  You’’ be able to print the result of any
7 to the console math operation in an IDE that you may
Install
 May seem useless, but comes in
handy extremely often

WHAT CAN COMPUTER’S DO: MODOULUS

 Most programming languages has an


additional operator known as
INFORMATION FROM COMPUTERS:
modulus
VARIATION OF THE PRINT STATEMENT
o Represented with %
 The print statement will vary  Allows us to get the remainder of a
depending on the language divisional operation
o In java, there are actually
MODOULUS EXAMPLE
multiple versions of the print
statement depending on  When we take 10 modulus 3..
whether or not you want a line o We essentially tell the computer
break to divide 10 by 3, ignore the
answer, and give us the
remainder -> 1

HOW DO WE GET INFORMATION FROM


COMPUTER: A BACKGROUND TOOL

 The console is mainly a Developer Tool


NO REMAINDER CASE
o Not usually meant to be used
and interacted with by the end  In the case where there isn’t a
user except in very abstract remainder
cases o The computer will simply
 Text-based games/simple print/return 0
programs
 Tends to be hidden away behind the
scenes
 Don’t try and implement the console
in the final product

EVENS AND ODDS

 This is extremely useful when


determining if a number is even or
WHAT CAN COMPUTER’S DO: MATH odd
o If a number modulo 2 is 0 - >
 The computer already knows how to
The number is even
do simple arithmetic
o If the number modulo is 1 - >
o Addition, Subtraction,
The number is odd
Multiplication and Division
STRINGS DIRECT STRINGS

 Strings are another way of saying text  Everything is inside quotes, so it’s just
o “hello world” one piece of text.
o “A”
o Anything enclosed by  No math happens; it prints exactly
quotation marks is denoted what you typed.
as a string

STRINGS EXAMPLE

Using concatenation (adding


strings together
 Print("Game over, ” + 4 + “ was your
final score”) CONCATENATION
 Console: Game over, 4 was your final
 "Game over, " → text
score.  "4" → text (so it can be stuck in the
COMBINING KNOWLEDGE middle)
 " was your final score." → text
 Print(“Game over, + (4+4) +” was  The + just glues them together into
your final score”) one line.
 Important: If you wrote + 4 +
 Console: Game over, 8 was your final
without quotes, many languages
score. would give an error, because you’re
QUOTATION MARKS IN STRINGS trying to mix text and a number
without converting the number to a
 Anything inside quotation marks is string.
treated as text (a "string") — not as a
number or code to calculate
 (“4”) is treated as a String
 (4) is treated as an Integer/Number
COMBINING MATH AND STRINGS

 (4+4) happens first (because of


parentheses) → result is 8
 str(8) converts it into text so it can be
joined with strings
THE + IN STRINGS
 Then + glues the pieces together:
 "Game over, " + "8" + " was your final
 When working with strings, + means score."
"stick them together" (concatenate
them), not "add" in the math sense.

console:

WHY YOUR CODE WORK THE WAY THEY DO


ADDING SPACES

No spaces

INTEGERS

 Integer’s
o A variable that can store and
integer value
With spaces  -2. 147, 483… (numbers)
 Can’t and will not hold any decimal
values

Booleans

 Can only store a value of either true or


In short: false
 Can only hold true or false
 Quotation marks → tell the o No other types of information
computer, "This is text, not code or
math." FLOATS AND DOUBLES

 + sign → joins strings together  Both are types of floating points


(concatenation). data types
o Can store numbers with decimal
 If you want to mix numbers and text, places
you have to turn numbers into  Float variables
strings first. o Can store up to 32 bits of
information
WHAT ARE VARIABLES: So what are they?  Double variables
o Can store up to 64 bits of
 Variables information
o Something that can be store
information STRINGS
 Can be referenced and
Manipulated  Useful for displaying text and storing
input information
VARIABLES BASICS o Information the user puts into
our program
 Each variable has a type. Name, a  Useful for outputting information in a
piece of information stored inside of it readable format for the user
o Name is simply a name for the
variable NAME VARIABLE EXAMPLE

TYPES OF VARIABLES  Prompt the user for their name


 Store the value inside of the “Name”
 Primitive type variables variable
o Integers, Booleans, Floats,
doubles, strings, and Chars
 Theres many types of variables
CHARS
 Char -> Character  Trying to reference a blank variable
 Each hold one character will result in a NullPointerException
 Useful when a programmer wants to
read one button press of one THE FATE OF VARIABLES
character in a string without using a
string variable  After code has run its course,
o Example: Game controlled by variables are deleted in memory
keyboard
o Tip: You can store char’s in a OTHER WAYS OF MANIPULATING VARIABLES
string variable, but not strings
longer than 1 character in a char  Integer, Float, and double variables
variable can be
o Added
Why are variables so useful o Subtracted
o Multiplied
 Often times you’re going to want to o Divided
keep track of things such as user’s o Modulused
name or score  String variables can be
o By creating a variables you can o Added
store this information in that  Char’s and Boolean’s can’t be
variable and then reference, add operated on
to, or modify it
 Other important uses for variables
o Taking input from the user
o Making your program have
variability
 Have it change based on
certain factors
o Manipulating variables is
necessary for many task in
programming

HOW DO WE MANIPULATE VARIABLES: What


happens when we define a variable
MANIPULATING STRINGS
 Create a little space in memory that
stores your variable name and its  While you can’t subtract, multiply,
contents divide or modulo strings, you are
able to add them

NAMING VARIABLES

 There is one big rule when naming


BLANK VARIABLE EXAMPLE variables
o They must be one continuous
 Reasons you want to store information String
in the variable down the road  Most programmers name variables
 Because you are going to use it to according to camelCase
store information given to you by the
user
o Don’t capitalize the first word, braces directly after the if statement
but capitalize the first letter of will run
all words after it

WHAT ARE CONDITINAL STATEMENTS

 Red lines – Our code will not be going


down this path THE ELSE-IF STATEMENT
 Green lines – Our code will be going
down this path  The Else-if statement will only be
evaluated if the preceding if (or if-
THE IF STATEMENT else) statement was bypassed due to
it being false
 The most basic conditional statement
is the If statement
o If something is True do this,
Otherwise do something else

IF STATEMENT EXAMPLE RUNNING THROUGH IF-ELSE STATEMENT

 Most programming languages use  Check the initial statement


braces () o If it’s true we run that segment
o Whatever is inside the braces of code and move on with the
will be evaluated as either true program
or false  If it’s not true
 If the statement is true, whatever is o We move on to any else if
enclosed inside a set of curly statement and evaluate those
conditional statements
 If any on them are true  As a result, they are unable to hold
o Run that segment of code and more than one piece of data
move on
WHAT ARE ARRAYS
THE SWITCH STATEMENT
 An array is a list of something
 An easily collapsible way to write o Can be integers
many if-else statements o Can be Strings
o You input a variable, then o Can even be other array’s
determine which “Cases” that  All information in an arrays is related
variable could be  Like columns in google sheets

THE SWITCH STATEMENT EXAMPLE

 Start with a colon (:) REFERENCING ARRAYS


o Each switch statement also
includes a “default” case (else  The single most important thing to
statement) note about arrays is how we reference
each element inside of them
o In programming we use Indexes
 That numbers “Place” in
the array

THE USEFULNESS OF CONDITIONAL


STATEMENT
 If you slip up and accidentally
 Adds variability to programming reference the 10th elements in this
o Program runs differently based array
on user input o Would result in an “out of
 If a user does something, we want to bounds” error since you are
be able to adapt accordingly actually trying to reference the
 Without, a program would run the 9th element
same way every time
CREATING ARRAYS
WHAT ARE ARRAYS: WHERE DO VARIABLES
FAIL  Populate First
o Insert the elements you would
 Variables are very good at storing like in the array immediately
singular bits of information
 Putting an array inside an array is
known as a 2-Dimensional array
o Similar to Matrices in
math/physics classes

 Populate Later
o Create an array with a specific
size, but choose to add elements
later

 To index 2D arrays we use 2 numbers


o First number is the row
o Second umber is the column

WHAT ARE LOOPS

 A loop is a statement that is used to


run certain instructions repeatedly
ARRAY SIZES  Very useful for repeated sections of
code
 When we create array their sizes are  Allows us to repeat parts of code
final multiple times
o Cannot be increased or
decreased in size through THE FOR LOOPS
conventional methods
 This is what allows us to  The floor loop
easily access their indexes o Used when you would like to
carry out a certain set of
instructions numerous times
 Consists of 3 parts
o An integer value
o A conditional Statement the
integer must reach to exit the
loop
o An operation to modify the
integer value after the
RESIZING ARRAYS instructions inside of the loop
are completed
 We CANNOT change the size of an
array within the code LOOP EXAMPLE

ARRAY TYPES

 When initializing an array, you must


determine its type then and there
o String array, Integer array,
Double array
 They have to all be the same type

2D ARRAYS INFINITE LOOP CAUTION


 When using a for loop, you must make  Perform operations many times in a
sure you set up a condition that, row
given the initial integer value and  Able to iterate through arrays and list
the operation, will at some point be  Decrease clutter of your code
met
o Otherwise an infinite loop will WHAT ARE ERRORS?
occur
 Code doesn’t always work as expected
THE FOR EACH LOOP  These are known as errors
o Come up often in computer
 The for each loop science
o Used for iterating through entire  Three different types
arrays or lists o Syntax error
 The loop will go through each element o Runtime error
in the array and carry out a set of o Logic error
instructions for each value
 Useful for performing operations SYNTAX ERROR
across an entire collection of data
 Parts in your program where you fail
THE WHILE LOOP to meet the programming rules
resulting in an error
 The while Loop  Usually the easiest of the 3 to solve
o Will continually carry out its  Highlighted by the IDE in most cases
instructions while a conditional
statement given to it is true DEBUGGIN SYNTAX ERRORS
 Similar to a for loop, but broken apart
 Can sometimes be used to purposely  IDE’s underline syntax error and
create an infinite loop usually provide helpful hints
 Syntax errors are like small
misspellings or grammatical errors
 Some IDE’s will restrict you from
THE DO-WHILE LOOP running the code unless all syntax
error are cleared
 The do-while loop
o Functionally similar to while RUNTIME ERROR
loops
o However, will always carry out  Don’t appear until you actually “run”
instructions AT LEAST ONCE the code
 Instructions inside loop will run once  Caused by a part of your code not
before checking the conditional being able to be computed in a
statement reasonable amount of time
o Most common form – The infinite
loop

INFINITE LOOPS

 Essentially what happens with the


computer
o It is given some condition with
no feasible way to finish that
task
 Puts the computer in error mode
BENEFITS OF LOOPS
 Will never reach the ending condition
causing a crash

PREVENTING RUNTIME ERROS

 Avoiding runtime errors


o Think through the flow of your  Commenting
code before running it o Allows us to mark-up the code
(especially loops) without the computer reading it
o Carefully plan out your code as actual code
before writing – PSEUDOCODE o Essentially a documentation tool
for programmers
LOGIC ERRORS

 The core runs smoothly without


runtime or syntax errors, but the
result isn’t what you wanted
 Often the hardest type of errors to
solve PREVENTING ERRORS
o Most of the time, the error is
unknown to the programmer  Backup code frequently
o Prevents you from saving a
PREVENTING LOGIC ERRORS backup that doesn’t work
o Makes it easier to figure out
 One strategy is coding incrementally when you wrote the error
o Test your application often so  Version managers such as GitHub or
that if you mess up you know Subversion can help
where the error is o Backup code to an online cloud
service in which you can easily
HOW DO WE DEBUG CODE: STEPS TO pull previous versions of the
DEBUG program
 Useful for backtracking to find when
 First step is to read the error the error is was written
o IDE will often print out an error
message to the console WHAT ARE THE FUNCTIONS
 Traverse to the line of code provided
by the error  We’ve actually been using functions
 Use online forums such as this whole video
StackOverflow o Print statements
 When a syntax or runtime error pops o For loops
up, you should be able to find a fix for o Basic math operators
it fairly easily  A Function
o A segment of code that can be
BREAKPOINT DEBUGGING easily run by calling the function
name
 Pauses the program when the line you o Depending on the type of
placed the breakpoint at is reached function, may do something in
until you continue return
 Can be called numerous times, and in
ACTUALLY FIXING THE BUG numerous places
 Like wrapping code into a present ang
 First try commenting it out giving it
PRINT STATEMENTS MAX FUNCTION EXAMPLE

 We call the print function, and enter in  Takes is two arguments (two integers)
what we want to be printed to the and returns the higher one
console inside the parenthesis
o Computer does it for us WHY ARGUMENTS ARE EXTREMELY USEFUL
 Behind the scenes there is more code,
which takes care of printing our  Arguments are a way for programmers
message to the console to have one function that can do many
 Abstracts all that code down to a different things
single line  Add variability to programming
 Helps diversify your code

RETURNING OR NOT

 Functions can either return variables,


or not
o Returning something simply
THE USE OF FUNCTIONS means the functions will return
back to the user something
 Functions serve many purposes  A string, Integer, array,
o Used to recycle sections of code etc.
which serve the same purpose
o Used for equations you want to RETURNING FUNCTIONS
allow multiple inputs of
o Used to save space within your  Returning functions must be returned
program INTO something
 Extremely powerful o Usually a variable but can also
 There are thousands of types of be printed
functions
o Oftentimes you will just import
the ones you need in your
program

THE TYPES OF FUNCTIONS

 There are 4 different types of


functions
o Separated by whether or not NO RETURN/NO ARGUMENT
they take in arguments
o Separated by whether or not  A function which takes no arguments
they return values and returns no values is similar to the
printStats() function
o Cannot be set to any variable
since it returns o values
WHAT ARE ARGUMENTS
ADAPTABILITY OF FUNCTIONS
 Variables we pass into a function in
order to be manipulated and then  Functions are super useful for making
either.. large changes to your code easily
o Returned back to us o Each function call is just a copy
o Printed to the console of that functions code
o Used in another operation
o Changing the function will o Often follow CamelCase
change all future calls of that Structure
function
TELLING THE COMPUTER WE’RE MAKING A
HOW CAN WE IMPORT FUNCTIONS FUNCTION

 Importing functions allows you to gain  Each language differentiates how you
access to libraries of pre-made tell the computer you are about to
functions make a function
o There are thousands of already o In java
made functions at your disposal  First your define the function’s scope
 Then you determine its rerun type
WHAT ARE LIBRARIES  Next is the function name
 Finally is a set parenthesis where you
 Collection of functions that all have would put your arguments
the same theme
o Math library, Data analysis
library, etc.

IMPORTING LIBRARIES

 Importing libraries is as simple as


using an import statement
o Usually consists of the word
“Import” followed by the library o In python
you would like to import  Write def, short for define
 Finally is a set of parenthesis
DRAWBACKS OF IMPORTING ALL CLASSES

 If you are only using one or two


classes form a package, it would be a
waste of computing power to import
the entire library

MAKING FUNCTIONS WHICH TAKE IN


AGRUMENTS
HOW DO WE MAKE OUR OWN FUNCTIONS
 We put any variables we want the user
 There are going to be moments where to pass into the function inside the
you want to create your own function parenthesis
 Basic rules you must follow o When we call the function, we
 Previous examples were abstract and are then required to pass those
didn’t go in-depth variables in as arguments

FUNCTION NAMING CONVENTIONS

 Function naming conventions follow


Variable naming conventions
o Can’t be two words
 Assign your arguments between the
parenthesis
 Define what you want to return
 Ensure no matter what path your code
MIXING VARIABLES TYPES takes, it returns something

 You can also mix variable types ARRAYLIST AND DICTIONARIES

 Arrays
o List of similar values that are
stored together
o Fixed size (cannot be increased)
CALLING FUNCTIONS o Reference values using an index
which starts at 0
 When you call a function, you Have to
pass in its designated variable types
o Otherwise an error will be
thrown

THE DIFFERENCE BETWEEN RETURNING AND


NOT  2 Dimensional arrays
o An array containing an array in
 When making a function which will each of its indexes
return a variable o Referenced using [row, column]
o In some cases you must define
what type of variable you will
return from that function

 Arraylist or list
o A growing array which
dynamically changes its size
o Starts with an initial size of 10

RETURN FUNCTIONS

 The most important thing about


making functions that return variables
is that no matter what path your code
takes, it must return a variable
 You cannot return one type of variable
if you have already defined the  Useful for when you don’t know the
function to return another type exact number of values that the
arraylist will need to store
 Also for if you want the ability to store
values to your heart’s content
o Such as database of users

AN INTRODUCTION TO DICTIONARIES

RETURNING WITH ARGUMENTS  A dictionary is like an array in that it


stores multiples values
 However, Instead of being referenced o When searching through huge
linearly, each value is tied to an lists, small differences in
identifier that is used to reference it efficiency
o Called it’s key
 When referencing a value in a
dictionary, you can use it’s unique
key, and the dictionary will tell you the
value tied to it
 Each key must be unique, otherwise
the computer will get confused as to
THE 2 STATES OF LISTS
what value the key is trying to
reference
 Lists can either be sorted or unsorted
 You can however store the same
values to different keys
 Dictionaries are also iterable, meaning
you can go through a dictionary and
perform operations or comparisons on
all values in them

ARRAYS, ARRAYLIST, AND DICTIONARIES

 All three boast certain advantages


DETERMINING EFFICIENCY
over one another
 Efficiency is based on two values
o Worst case scenario
o Average number of items
 Known as Big 0 notation

HOW CAN WE USE DATA STRUCTURE

 Searching algorithms
o Ways in which we can look
through a list of values store in THE LINEAR SEARCH
an array and find a particular
piece of data  Linear search
o Start at the beginning and
systematically check each data
point until you find what you are
looking for
 Worst case scenario
o We have to check every element
in the list – 0 (n)
 Average Scenario
o On average we find our search
THE SPEED OF COMPUTER term halfway – (n/2)
 While computers today ARE much THE DUALITY OF THE LINEAR SEARCH
faster than before
 The linear search can work on both
sorted and unsorted lists

THE STACK

 A data structure which contains all of


the tasks you instruct your program to
complete
 Based on a certain method, your
THE BINARY SEARCH program will then carry out the tasks
you give it
 Uses a recursive process
o Break down the list into smaller
and smaller parts to find the
item you’re looking for faster
 Takes advantages of the fact the list is
sorted LIFO STRUCTURE

 This means the last item put on the


stack will be the first one removed
from it

EFFICIENCY OF THE BINARY

 Worst case Scenario STACK OVERFLOW


o Runs in Logarithmic time - 0(log
 If you were to create a recursive
n)
function without a reachable base
 Average Scenario
case
o On average we find our search
o Processes would continue to be
tern in logarithmic time – 0 (log
added to the stack, Causing a
n)
stack overflow error
WHAT IS RECURSION

 In practice of using functions that


repeatedly call themselves
 In the instructions that occur within a
function
o One of the instructions will be a
call to that same function

 A data structure which contains all of


the tasks you instruct your program to
complete
 Based on a certain method, your  Easier to port between operating
program will then carry out the tasks systems
you give it  Many times also used in web
development

GENERAL PURPOSE LANGUAGES

 Offer a wide variety of uses and


applications
 Very good basic languages
THE USES OF RECURSION
Java – Game/web development
 It breaks large problems into such Python – Data analysis/scripting
simpler pieces to compute C++ - Applications/system program

CHOOSING THE RIGHT LANGUAGE: WHAT


LANGUAGE SHOULD I LEARN

 The world of computer science is vast


and contains many fields, so trying to
cover anything in one language would
be impossible
o Led to the creation of thousands
of different programming
languages

HTML/CSS

 HTML and CSS


o Used for web development
 HTML
o A markup language used for
writing the content of the
website (not a programming
language)
 CSS
o Used to design the style of a
website

SCRIPTING LANGUAGES

 Language with many commands for


you to use that can be run without
being compiled
JAVA PROGRAMMING

For [Link]
//%[flags]
String - %s
Char - %c
Int - %d
Double - %f
Boolean - %b

For scanner
Import [Link]; //put at the top
Scanner scanner = new Scanner([Link]);
[Link](); //don’t forget to put this

String - text
Char – one single letter
Int – number
Double – decimal number
Boolean – true or false

‘’__” – String/text
‘_’ – letter

// if(___.equalsIgnoreCase("__")){
//if(____.equals(“__)){

If(){
[Link](_____);
}
Else{
[Link](_____);
{

/n – next line/space line


[Link] – next line

You might also like