Transcripts
1. Java course introduction: Welcome everyone to Java
Programming Language course. This course consists of
different types of classes. In the first class, we
are going to discuss about complete
introduction to Java. In the second class, we are going to
discuss about how to download and install
Java for our computer. So in the upcoming classes, we are going to discuss about the concepts like datatypes, variables, conditional
statements, and exception. In the final class, we are going to discuss
about how to create a mini project using Java
programming language. This course is useful for the
students who are trying to learn Java programming
language for the first time. So let's get started.
2. Java presentation: Welcome, everyone
to the first class. In today's class, we
are going to discuss about complete
introduction to Java. So Java is powerful
programming language, which can be used in
all kinds of platforms. So the platforms like
Mac, Windows and Linux. Also, if you learn Java, Java can be used in all kinds
of variety of applications. So that's the speciality of
Java programming language. After that, we are
going to discuss about history and evaluation of Java. So Java was first introduced in the year 1991 by James
Gosling at Sun Microsystems. And in 1995, Java
was used for variety of applications like desktop applications
and web publications. So in the year 2006, Java Verson six was released. So after that, we can see the Java latest to
verson that is 22. So we are going to discuss about the
fundamentals of Java. So the first one is the
syntax and structure. So Java follows strict
structure of syntax. We cannot misuse
the syntax of Java. And the second one is nothing but object oriented programming. So the object oriented
programming like inheritance, abstracts and enhabss
and polymorphism. We can use this Object-Oriented Programming language with Java. And then third one will
be platform independence. So platform independence
is nothing, but we can run Java in
Windows, Linux and Mac. And the fourth one is nothing
but Robot standard library. So Java comes with
standard library. So values or functions
does not change. After that, we are
going to discuss about the datatypes
and variables. So in Java, there are
many primitive datatypes. So primitive datatypes
like integer, double boolean, and then
reference datatypes. So reference datatypes are like string array,
and custom classes. So then you can see
the variables is nothing but a container
which is stores the value. We are going to
discuss the datatypes and variables in the
upcoming classes. And then we are going to discuss about applications of Java. If you learn Java, you can use variety
of applications with the help of Java
programming language. So there are many applications
like web development, enterprise applications,
mobile development, and then big data and analytics. At last, we are going
to discuss about job opportunities
if you learn Java. So the job opportunities
like software engineer. So software engineers
can be many types, whether it can be
web development, mobile development or
desktop development. And then the second one
will be big data analysis. And then third one is nothing
but Android developer, Android developer or nothing but mobile application
developers. So that's it. In today's class we discussed about complete
introduction to Java. In the upcoming classes, we are going to discuss
about datatypes, variables, far loop, il loop in the Java
programming language. So let's see in the next class
3. Installing Java JDK : Welcome everyone to
the second class. In today's class, we are
going to discuss about how to download and install
Java for our computer. And then you can see the
platforms available for Java. For that, we are going
to install Windows, and also we can see
the JDK versons so you have to wait for the
process to be completed. So after that, you have to open the JDK from your computer, and then you have
to select next. So you have to remember
the path of the file. So we are going to install the JDK version
for our computer. So you have to wait for the installation process
to be completed. So after that, you
have to select closes for the
successful installation. So then you have to open your computer and
then program files. So inside that, you can see
Java and then version 22, so you have to open the folder. So then you have to
open Bin folder. So you have to copy the
path of the Bin folder. For that, you have
to select that copy. So after that, you out to
open PC and properties. So inside that you
have to select advanced system settings,
environment variables. User variables, you
have to select path, and then you have to select new. So you have to select new
for the copy and paste. So you have to copy
paste the link, and then you have
to select Okay. So you have to open
the system variables, so you have to check path and also you have to select
New and then copy paste. Select Okay, Okay. Okay. So that's it. So after that, you have to
open the command prompt, so you have to type CMD, and then you have to type
Java hyphen hyphen erson. So you can see Java is
successfully installed for our computer
with latest version. So after that, we are
going to discuss about Visual Studio code ID for
running our Java projects. For that, you have to
create a new folder. In the new folder,
you have to right click and then you have
to select open with code. We are going to use this
folder for our Java programs. So you have to wait for that. So in the extension, you have to download
and install Java. So for that, you
have to type Java. And then you can see
the extension for Java. So how to download
and install that. So after that, you can see the options available
for the Java package. So how to install whatever extension
you want to run Java. So that's so that's it. In today's class, we are
discussed about how to install and download Java JDK
for our computer, and also we are discussed about how to create
a new folder and how to install the extension for Java in Visual Studio code. In the upcoming class, we
are going to discuss about the Java concepts like
Halo world program, variables, datatypes, conditional statements
for loop, Y loop. So let's see in the
upcoming class.
4. Running java in vscode: Welcome everyone to
the third class. In today's class, we are
going to discuss about how to create our first program
using the Java language, and also we are going to discuss about the syntax for Java. So let's get started. So open your VSCode, and then you have
to select Control N for creating the
new file in VSCode. After that, you have to
select the language. For that, I'm going
to type Java. So we are going to
use Java language. So I'm going to zoom my VSCode. So after that, you have
to type your filename. So you can type
your own filename. So I'm going to
type hello world. So you have to remember
that you don't have to type space between the file name because it will give error in the file
name of our project. For that only, you don't have to type space between
the file name. So after creating your file, we are going to discuss
about the syntax for Java. From the starting position
to last position, what will be the syntax
format for the Java? So first, you have to
create a class in Java. So that's the first
step in Java. So for that, our
class will be Bublic. So that's the keyword. So Bublic class can be
accessed by everyone. So then you have to
type your file name. So file name will be our
class name, halo world. So after that, you have to
type the curly brackets. Inside the curly brackets, you have to create main method. So main method also bubblic. And then you have
to type static. So static is nothing, but our main function
value does not change. And then you have to type void. Void is nothing, but our main function will
not return any values. And then you have to
type the main keyword. So inside the bracket, you have to type string, so our main function will
accept only string values. Again, o to type
the curly brackets. So this is the simple
syntax for our Java. So after that, I'm
going to discuss about how to print
the values in Java. For that o to type system. So system is the keyword, dot, dot, print LN. N is nothing but new line. Inside the bracket, you
can type your word words. For stream, you have to
type inside the quotation. So I'm going to type halo world. So you have to
remember that in Java, whenever you type a statement, you have to put semicvalent
to complete that statement. So that's the basic
syntax for Java. So you have to run the code. So you can see in the output, hello world is generated. We have successfully created our first program using
Java language in VSCode. So in the upcoming class, we are going to discuss
about variables in Java. So let's see in the next class.
5. Java variables: Welcome everyone,
in today's class, we are going to discuss
about variables in Java. So variables is nothing but a container which
stores the value. So that's the concept
of variables. Variables will store value. So we are going to discuss
about how to create variables, and also we are going
to discuss some of the rules for
creating the variables. So let's get started. So whenever you
create a new file, you have to create
a class for Java. So class can be Bublic. I'm going to type Bubblic class. So that's the keyword, and then you have to type
the file name variables. So variables is the file name. And then curly brackets. Inside that you have to
type the main method, so you have to type Bubblic
static void main string hops. So in VSCode, the code will
be automatically generated. So that's the
speciality of VSCode. So again, you have to
type the curly brackets. So inside the curly brackets, we are going to
create our variables. So first, we are going to create the datatypes for the variable. So datatypes can be integer, float, and character string. So there are a lot of datatypes, so you have to type
in A equal to ten. So A will be considered
as variable. Ten is considered as value. So A stores the value ten. So that's the
meaning of variable. Variable is like a container
which stores the value. So A is the container, which is Ts the value ten. So after that, I'm going to
create the second variable, so you have to type
the depth type, string, and then you have
to type the variable name, name equal t. For string, you have to type the
double quotation. So inside the quotation, you can type your O and words. So whenever you
type a statement, you have to put
semicolon at the end. So string is the datatypes. Name is the variable. Run is the value. So name is the container, which is Ts the value RN. So that's the
concept of variable. So after that, I'm
going to discuss about how to print
the variables. So for printing the variable, you have to type the
same syntax we are discussed in the previous
class system dot, dot print Ellen off. So inside that you have to type the variable name a so again, we are going to print the
second variable that is rule. For that to type name, that's the variable and
then put semicolon. So that's the way of
printing the variables. So you have to remember that
you to type datatypes must. For Python and other languages, datatypes can be
automatically generated. But in the case of Java, you have to type the
variable with the datatypes. So that's the syntax for
creating the variable. So variable must
contain datatypes. So after that, you have
to run the code for that, you have to select Run code. So in the output, you can see the variable with the
value RN and ten. So that's the value.
We are printed from our variable. So that's it. In today's class,
we discussed about how to create variables in Java. So in the next class,
we're going to discuss about datatypes in Java.
6. Java scanner: Welcome, everyone.
In today's class, we are going to discuss
about Scanner in Java Scanner is
very, very useful. It will generate the
input for our user. For Scanner, you have
to import the package, so you have to type Import
Java dot util dot Scanner. So this package is very, very useful for the Scanner. For getting the
input from the user, you have to use the
Scanner function. And then you have
to type the class, so class can be
your own Scanner, and then you have to
type curly brackets and then you have to
type main method, public static void
main string args. So Scanner is nothing, but if you want to use
user defined input, you have to use Scanner. So for the Scanner, it is one of the type of class. For class, you have
to create an object. So Scanner is the class. AC is the object, equal to U NU will create a new object for
the Scanner class. And then you are
to type system.in. So system.in is nothing, but our input will be generated
in the VSCode terriminal. So that's the use of
system dot input. And then you have to tie user defined inputs for the input, I'm going to create
an integer input t A cul til as is the
Scanner object, c dot next int off. So that's the syntax for user defined input for
the integer datatypes. So after that, I'm going
to print the value of A. Before that, I'm going to ask the user for the integer value. So to type enter value
or Enter number. You can type your own
value for the integer. So we have to remember
so you have to copy and then paste
before the integer. So user types the number and the number will be
stored in the A value. And then we are going to
print the value of A. Whatever the user
types the value, it will print in the
output. So that's it. You have to save your class and then you have
to run your class. So in that you can
say enter number. You have to type your
whole number 20. And then our output source 20 because we have
printed our way variable. So that's it. In today's class, we are discussed
about how to get user defined input using
the Scanner function.
7. Java datatypes: Come, everyone.
In today's class, we are going to discuss
about datatypes in Java. In Java, there are many
types of datatypes. So for example, you can see
the datatypes like integer, string, float,
character, double. So we are going to discuss
about how to create datatypes. So for that, first you have
to create a class in Java. So for that, we are going
to type Bubblic class. So our class can be
accessed by everyone. And then you have to type
the file name datatypes. So inside the curly brackets, you to type the main method, main method is also
bubblic static void main. That's the keyword.
Inside the bracket, you out to type string, arcs. So arcs is nothing
but arguments. So again, you have to
type the tar brackets. Inside that, you have
to type your datatypes. So first, we are going to
see the datatypes integer. So integer A equal t ten. So first datatypes
will be integer. After that, we are
going to discuss about the second datatypes that will be float datatypes
for float to type float. So that's the keyword and then
B variable equal to 20.4. Float is nothing
but point values. So that's the second datatypes. After that, we are
going to discuss about third datatypes that will be considered as
string datatypes. We are going to use
string datatypes. String C equal to,
inside the quotation, you have to type the value, so can type your own values. So after that, we are going to discuss about Boolean datatypes. Boolean can be two types. The first one will be true, and then second
one will be false. True and false are types
of Boolean datatypes. So for true and false, you ought to type lowercase, you don't have to type
in the upper case. So both can be lowercase
and then uppercase. So there are two types. First one is true and
then second one is false, both in the lowercase format. So after that, we are
going to discuss about character datatypes,
character E equal. So for character,
you ought to type, single quotation because
alphabets are single values, not more than one value, that's why we have to
type single quotation. Last, we are going to discuss
about double datatypes. Before that, double
is also same as float because both are
point value datatypes. For that, only in
Java, for float, you ought to type F. F will be considered
as float values. So you have to
remember that in Java, you ought to type F to make the values as float datatypes. So you have to remember
that so double, and then you have
to type the value. So double can be 30.5. For the difference only, we have to tie for float, you so that's it. So these are all the
datatypes available in Java. So after that, we are
going to distance about how to print every
value one by one. For the printing the values, you have to remember the syntax. So it will be considered as
system dot of dot print off. So you have to type one by one. First, we are going to print A. So you have to run the code. So you can see ten. So ten is printed because
ten is integer. So if you want to
clear the output, you have to type CLS. So CLS is nothing but
clear the previous output. So after that, we are
going to print B. So B will be
considered as float. Before running any output, you ought to remember that
you have to save your file. If not, the previous
output will be generated. Your current output will
not generate in the output. After saving only, your current
output will be printed. For that only ought to remember that every time you
have to save your file, after that, we are
going to discuss about typecasting in Java. So typecasting is
nothing but converting one data type to
another datatypes. So that's the concept
of typecasting. So for example, we
are going to convert the integer datatypes
to float datatypes. That's the meaning
of typecasting. So for that, we are
going to see an example. So first, I'm going to create
the integer datatypes. So you have to type
in A equal to ten. And then I'm going to create a second datatypes
that is float. I'm going to convert the integer datatypes
to float datatypes. So you have to type
float B equal to. Inside the bracket,
you have to type your conversant datatypes and then you have to type
the variable. That is A. A will be converted from integer datatypes
to float datatypes. And then stored in the
second datatypes value B. So first, you have to create a datatypes that
is integer datatypes. And then I'm going to convert the integer datatypes to float datatypes using this syntax. So syntax is nothing
but inside the bracket, you have to type the
conversant datatypes. That is integer. So after that, I'm going to print the value
for that you have to type the same syntax system
dot of dot print LN off. So print LN off. Inside that you have
to type the value. I'm going to print A and also B. So A will be considered
as integer datatypes. B will be considered
as float datatypes. So you have to remember
the conversion. So you have to save your file, and then you have
to run your file. So in the output, you can see ten and 10.0. So you have to clear the
screen for that totype CLS. And then you have to
run the code again for clearing the
screen, to type CLS. So you can see ten and 10.0. So ten is the integer datatypes. So and then 10.0 is nothing but float
datatypes. So that's it. In today's class, we discussed
about datatypes in Java, and also we are discussed
about typecasting in Java.
8. Java arithmetic operator: Welcome, everyone.
In today's class, we are going to discuss about arithmetic operators in Java. So arithmetic operators
are like Addison, subaction, multiplication, divison modulus, floor divison. So these are all the types
of arithmetic operators. We are going to discuss
one by one in the class. So first, you to create
a class in Java. So for that you
have to type Bubli. So that's the keyword
and then you type class. So class name will be
considered as arithmetic. Main method that is bubbli static void
main of string, ARGs. Off. So again, you auto
type the curly brackets. So inside that we
are going to discuss the arithmetic
operators one by one. So for the arithmetic
operators first, I'm going to create the values. In A equal to ten, or you can type your own values and then in B equal to 20. So we are going to do the arithmetic operators one by one. For that, I'm going to create a system variables for
printing the values. For that I'm going to type the print values system
dot dot print LN of. Inside that, I'm going
to type A plus B. A plus B is nothing but Addison, so it will be the type
of arithmetic operator. And then I'm going to type
other operators one by one. So second will be
subaxen, A minus B, and then third one
will be multiplation, fourth one division,
fifth one modulus. So you have to take modulus. So these are all the
arithmetic operators in Java. So Addison is nothing
but ten plus 20. Subaxon is nothing but ten -20. Multiplication is
nothing but ten into 20, and then last one
will be A modulus B. So difference between divison
and modulus is nothing, but in divison output
gives the quotient values. In modulus, the output
gives the remainder value. So that's the difference between divison output and
then modulus output. So after that, I'm
going to run the code. So you can see in the
output 30 minus ten, 200, zero, and ten. So these are all the outputs of the arithmetic
operators, Addison, subraction multiplation, division, and then
modulus. So that's it. In today's class, we discussed about arithmetic
operators in Java. So in the upcoming class, we're going to discuss about comparison operators in Java.
9. Java comparison operator: Welcome, everyone.
In today's class, we're going to discuss about comparison operators in Java. So first, you to create a
class, so Bublic class, and then you have to
type the class name that is comparison, so you have to type the
class name, correct. If not, the output source falls. For that only to type
the class name, correct. So inside that you
have to create the function that is
the main function, static void main of string ARGs RA so after that, you have to create the
comparison operators. So there are many comparison
operators in Java. First, we are going to create
the variable A equal to 20. And then we are going to discuss about the comparison operators. So we are going to create
system dot of dot print dot N. Print LN of. So that's the first
variable A equal to equal to B S to type, correct. If not, the output source falls. So we are going to type
more than five times. So a greater than a less than a not equal to A
greater than or equal to. So these are all the comparison operators greater than or equal
to less than or equal to. So in the output of the
comparison operator it will give bole in values
like true or false. So A equal to equal to B, no, it is not equal to. So output gives false. A not equal to B. Yes, A is not equal to B, so it gives true. A greater than B. A is greater
than B than gives true. And then A less than B, no, A is not less than B. So that's why
output gives false. And then A greater
than or equal to B, S A is greater than
B. So it gives true. At last A less than equal to B, S. No, A is not less
than B. It gives false. So you ought to save your pi, and then you to run your file. So in the output, you can see
the Boolean values false, true, true, false, true, false. So these are all the
corresponding output of the comparison operators. So that's it. In today's
class we are discussed about comparison
operators in Java.
10. Java logical operator: Welcome, everyone.
In today's class, we are going to discuss about
logical operators in Java. So for that, there are three
types of logical operators. The first one will be and
and then second one will be, and then third one
will be naught. We are going to
discuss one by one. So for that, first you
have to create a class, so you have to type class, and then you have to
type the file name. So inside that you have to
create the main function, bublic static wide main, and then you have to type string ARGs of
array, ARGs array. So again, you have to
type the curly brackets. Inside that, we are going to discuss the logical operators. In A equal to ten, you can type your own values. So inside the bracket, you have to type the condition. So condition can
be a greater than ten and then you have
to type the symbol for. So symbol for and,
and then you have to type the second
condition a less than 20. You can type your own values on condition whether it
is less than or equal. So for the condition
for is nothing, but the two conditions
must be satisfied. That is, the two condition
must provide the output true. If not, output provides false. So that's the concept for and two condition
must be satisfied. So for that, you have
to see the example A greater than ten and
then A less than 20. So in the first condition,
A greater than ten. Now, A equal to ten. And then second condition
A less than 20. Yes, A is less than 20. So that's why so that is
one condition is satisfied. So output gives falls because in and both
conditions suit satisfied. So you can see in the
output, so in the output, you can see false because only one condition is satisfied. A, greater than ten. No, the condition
is not satisfied. A less than 20, yes, the condition is satisfied. So that's why it so false. So after changing the condition, you can see true because both
conditions are satisfied. A, greater than equal to ten, A is equal to ten, and then A less than 20, A is less than 20. So that's the condition
for and two satisfied. So after that, we are
going to discuss about the second logical
operator that is R. So you have to type
the two conditions. Again, you can type
your own condition, whether it is a less than
ten or a greater than ten. And then you have to
type the R symbol, R symbol, and then you have to type the second condition
A less than 20. So in R condition, any one condition is
satisfied is enough. Unlike and two conditions
are satisfied. After that, only
output source true, but in any one
condition is satisfied, the output source true. So the condition is
a greater than ten. No, A is equal to ten, but A is less than 20. One condition is satisfied. So that's why in the output, it will generate as true. So in the output,
you can see true. So that's the concept of anyone is satisfied,
output source true. So if both conditions
are not satisfied, in the output source false. So after that, we are
going to discuss about the last logical
operator that is not. So the concept of naught is nothing but opposite
of the values. That is, if the output gives
true, not gives false, if the output gives false, not gives true, that's
the concept of not. So naught is nothing but true gives false,
false, gives true. So for our condition, A greater than ten. No, A is not greater than ten. A less than 20, A
is less than 20. For R, because anyone is condition is satisfied,
output source true. But in the case of naught, it changed the values
true to false. So you can see for in the R
condition, you can see true. But in the case of R again, but to type naught,
naught gives false. So that's the concept
of not condition. Not is vice versa, true, use false, false use true. So that's it. In today's
class we are discussed about logical operators in Java.
11. Java if Else class: Welcome, everyone.
In today's class, we are going to discuss about conditional statements in Java. First one will be if and
then second one will be else if and then third
one will be else. So these are all the
conditional statements in Java. So we are going to
see an example, first you have to
create the class. So bub class if, and then you have to type the
curly brackets inside that, you have to type the main
function, bubblic static void. So you have to type the
keywords, correct, wide main. So that's the keyword
and then string ARGs. Again, you have to type
the curly brackets. So after that, inside that, you have to type the
conditional statements. For that, we are going to see an example for the
conditional statements. We are going to use the grading for the conditional statements. So we are going to find
the grade of the students, whether it is A grade, B grade or C grade based on the mark so for that only we are going to
create the variable mark. So we are going to create
a mark equal to 60. You can type your own value. So our student mark is 60. We are going to find
the grade of the mark. First, you have to create the I. So I is the starting
conditional statement. After that, only have to
type else if and else. So for the if you are
to type the condition, so the condition
will be mark equal to equal or greater
than equal to 90. So if the mark is greater
than 90 or equal to 90, the student will be
considered as A grade. So you have to type the
system dot out that printer and A, you have to type A. So conditional
statements are nothing but one condition is satisfied, it will print the output. If that condition
is not satisfied, second condition
will be considered. So if starting condition, starting condition is nothing but more greater than Recalt 90. If that condition is satisfied
with the student mark, the output will
generate a grade. So that's the use of
conditional statements. So it based on some conditions. So if the I condition
is not satisfied, we are going to use
ALIF condition. So ALIF is nothing but second I. So ALIF also contains condition, so the condition is nothing but more greater than a equal to 50. If that condition is satisfied, we are going to print B grade. I condition is satisfied, A grade will be generated. If not, else if is considered. If that condition is satisfied, it will print B grade. If two condition
is not satisfied, we are going to use the last
condition that is else. So you can type many if
and else if conditions. So if both conditions
are not satisfied, then on how to type else. Else, you can type
your own grade. So you can type your own grade. So I'm going to type the
student is considered as fail so to type system
dot dot print LN of. Inside that, you can
type your own value. I'm going to type fail. So if two conditions
are not satisfied, the student grade is
considered as fail. Rf plus Rf. So you can type your own value. So that's the conditional
statements in Java. First, I'm going to create the mark is considered as hist. And then I'm going to type the
first condition in the IF, you can see the condition M
greater than or equal to 90. If satisfied, it will
consider as A grade. If not satisfied, else
will be considered. So in else, if M greater
than or equal to 50. So if that condition
is satisfied, our output will generate B
grade based on our sudan mark. So if two conditions
are now satisfied, our output will generate fail. So I have to run the statement. Okay, we generated some errors because the syntax
else if it's changed. For the Java, you
have to remember that you have to type else if no IF. In Python only you to
type ALIF in Java, auto type else if you have to remember the syntax for
the conditional statement. So you have to type
else if not ALIF, IF is the syntax for Python
conditional statement. So after that, we have
to run the statement. In the output, we can see B
grade because our mark is 60. So first statement is not satisfied because our
mark is less than 90. So in the second statement, you can see more greater
than equal to 50. Yes, our mark is
greater than 50. So that's why this
condition is satisfied. Outputs source B grade. So that's it in
today's class we are discussed about conditional
statements in Java.
12. Java break condition: Hello, everyone.
In today's class, we are going to
discuss about break and continue statement in Java. So first, we are
going to discuss about break statement in Java. So for that, you have
to create a class. You have to type Bubic class, and then you have to
type the class name. That is break continue. And then you have to
type the curly brackets. Inside that, you have to
type the main function. So bubblic static, wide. Main of string ARGs off. Again, you ought to type
the curly brackets. So inside the curly brackets, you ought to type the loop. First, we are going to discuss the break statement with
the help of y loop. For example, I'm going
to use I'm going to print ten values
using the il loop. So you have to type the integer, I equal to integer, I equal to zero. So that's the starting value. And then you have to
type the y and then you have to type the
condition I less than ten. You have to type curly brackets. Inside that, you have
to type inside that, I'm going to type
system dot, dot, print Elano for printing
the ten values. So zero is the first value. Nine is the tenth value. So you have to remember that
you have to print I value. After that, you have to type I rating value one by
one, I plus plus. So zero, one, two, three, up to nine. So you have to run the code. So in the output, you
can see zero to NN. That is ten values are printed in our output using the y loop. So this is the simple ile loop. From this output,
I'm going to show you the concept of
break statement. So break condition is nothing, but if I don't want
to print 5678 NN, I'm going to use the
help of break statement. 5678 Nan will not print in the output with the
help of break statement. So only zero, one, two, three, four
will be printed. For the break, you have
to use the I condition. So you have to type I and then you have to
type the condition, I equal to equal to pi. So that's the condition. So if the I value
becomes from the five, the value will not present in the output with
the help of break, you have to type break. So you can see zero, one, two, three, four. After that, I becomes p then our output will not print
the value from the five. So that's the use
of brake condition. So you have to remember that brake is nothing
but exit the loop. For the continuous statement, I'm going to show you an
example with far loop. So for the continuous statement, I'm going to use the far loop. For break statement, I'm
discussed the y loop. For continuous statement, I'm going to discuss with far loop. So for that, you have to
type the far loop syntax, I equal to zero, I
less than or equal to ten or less than
ten I plus plus. So that's the syntax. And then you have to
type if condition if I becomes five or six
are your own values, I equal to equal to pi. And then you have to
type, break or continue. If you want to use break,
you can type break. If you want to use continue, you have to type, continue. So continue is nothing, but it skips the value. So in the output, you
cannot see the value Pi. Other values will be present. So after that, you have
to print the values. You have to type
the same syntax, that is system dot
out dot printer ano I so that's the concept
of continuous statement. So you have to run the code. So in the output, you can see. So in the output, you can
see Pi is not printed because p value is
skipped from our output. Other than five, other
values are present, 67, eight, nine are present. If I change the value to six, so then our output will
skip the value six. So you can see f is printed, but six is not printed because continue
will skip the value. So that's it. In today's
class we discuss about break and continue
statement in Java.
13. Java while Loop: Welcome, everyone.
In today's class, we are going to discuss
about Wil loop in Java. So Wil loop is also same
as far loop for printing the halo world more than ten times or more than 100 times. For that, I'm going to show
an example for printing the halo world more than
ten times using the loop. So loop the syntax is
different from the far loop. So first, you are
to create a class, so you have to
type Bublic class, and then you have to
type the class name. So class name VL. And then curly brackets, and then you have to
type the main function, Bubblic static void
main off string, ARGs of curly brackets. Inside that, you have to type. Inside that, I'm
going to type hello world for that I'm going
to use the string. That's the datatypes,
and then A hello world. So I'm going to
print hello world more than ten times
using the while loop. So after that, you have to type the starting value
I equal to zero, and that is integer datatypes, and then you have
to type the le so inside that you have to tie the condition I less than ten. If the value of I
is less than ten, then only the wild
block will be executed. So in while first, the condition is satisfied, then only output will generate. So after that, we
are going to print our value for more
than ten times. So you have to type
system dot out, dot, print and off, and
then you have to type the variable A, put semicolon. So A is considered as the
value of hollow world. So after that, you have to type the iterating value one by one for that you have
to type I plus plus. So I plus plus is nothing, but it will iterate the value and increase
the I value one by one. So first, it will be zero. And then second,
it will convert it to one and then
incremented to 23, four, five, six, seven, a nine Nye values
will be generated. So after NN, the condition is not satisfied because ten
is not less than ten. So that's why the output
only sows ten values. So in the output, you can see, How world is printed ten times. So that's the use of wild loop. So loops are nothing, but if you want to print
any value more than ten times without the help of
system dot dot print value, you have to use loop
14. Java for Loop: Welcome everyone.
In today's class, we're going to discuss
about far loop in Java. So far loop is very, very, very useful if you
want to print a value more than ten times or more
than 100 times for normal, we're just using the system
dot out dot printer an off, so you can type your Van values more than ten times
or 100 times. For that problem, we are
going to use the far loop. Loops are nothing, but
it will itrate the value more than ten times or 100
times based on your condition. So that's the use
of loop in Java. First, we are going
to see the far loop, and also we are going to discuss about a syntax for far loop. So you have to create a class. So class will be bubblic class, Bublic class for loop. And then you have to
type the function. Function is main function void. And then you have to
type the curly brackets. Inside that, you have
to type the far loop. For that, I'm going to show
you an example for far loop. So I'm going to print halo world more than ten times.
You to type far. Inside the bracket, you ought
to type starting value. It I so you have to
type the datatypes, and then you have to type
the I rating value that is I for printing the halo
world more than ten times. So for printing the value of
halo more than ten times, we're going to need
the help of I, so I equal to zero. So the starting value
will be zero to nine. Total value will be ten, and then less than or equal to ten so less than equal to
ten is the ending value. Ten values will be printed. And then I rating
value one by one, that is I plus plus. So zero, one, two, three, four, five, so that's the
I rating value one by one. So that's the I plus plus. So I equal to zero is
the starting value. So zero will be first value. I less than equal to ten
will be the last value. So after that, I'm going
to print the value of the variable A far
more than ten times. So inside that you have
to type the value A, And then you have to put
semicolon to end the statement. So you have to save your file, and then you have
to run your file. So in the output, you can see, her world is printed
more than ten times. You can see 11 times
will be printed because 00 will be
the first index. Less than are equal to ten. Zero to nine is ten values, but less than or equal to ten. That will be considered as ven. Laven values of her world
is printed in the output. So that's it. In
today's class we discussed about
far low pin Java.
15. Java switch Condition: Welcome everyone. Today's class, we are going to discuss about
switch statement in Java. So for that, we are
going to see an example. So first, you have
to create the class. So after creating the class, you have to type the funton
so funton you have to type bub static wide main
of string ARGs off. Again, you have to type
the curly brackets. Inside that, you have
to type variable. So we're going to
see an example. First, you have to
type the variable. Before typing the variable, you have to type the datatypes. So It will be considered
as the data type, and then d equal to two. So you can type your own day. Going to find the
day of the value. For that only, we are going
to use the switch condition. So you have to type
the keyword switch. So inside the bracket, you have to type
the variable name. So variable is day, and then you have to
type the curly brackets. So inside the curly brackets, we are going to create
the case blocks. So you can type your
whole number of cases. First, we are going to create
the case, that is one. So first, we are going
to create the case. So how to type case, that's the keyword case one. So if the value of d is one, then case one will be
generated in the output. Inside the block of case one, whatever you type, it will
generate in the output. So for that, I'm
going to simply type print value so you have to
type system dot dot print off. If the day is one, it will
be considered as Sunday. Break is nothing, but if
the output is satisfied, this block will be
generated in the output. Other blocks will not
generate in the output. For stopping the other blocks, we are going to need
the help of break. After that, we are going
to create the case two. If the value of day case two value will be
generated in the output. So I'm going to print the
system values out dot print. No, Monday. So case two will be Monday. And then you have to type break. So break is very, very useful to stop the other statement
to execute in the output. So this is the simple syntax for switch condition in Java,
switching the conditions. So one condition
is not satisfied, it will move to the
second condition. If the second condition
is not satisfied, it will move to the
third condition. So there are two conditions. So if the value
of that condition is satisfied with
the variable value, it will generate in the output. So one will not satisfied
because the day is two. That's why this code of block will not generate in the output. Sunday will not
print in the output, but you can see two. Two is satisfied
with the day two, then this code of block will be generated in the output
with the value Monday. So you have to save your
file and run your file. So you can see
Monday because they equal to two is satisfied
with the s equal to two. So that's the function
of switch condition.
16. Java try Exception Handler: Welcome, everyone.
In today's class, we are going to
discuss about excepts and handling in Java. For excepts and handling,
there are three blocks. So the first one
is the tr block, and then second one is the catch and then third one
is the final block. We are going to
discuss the example for excepts and handling. So first, you ought
to create a class. So class will be
try catch finally. So our class name is nothing
but try catch finally. Inside that, you have to
type the function that is bubblic static void
main of string A or Gs, off, and then you have to
type curly brackets again. So inside that, we are going to discuss about the
excepts and handling. For exception handler,
there are many types. So for example, if you
divide AD value with zero, the one of the except and will be generated in the output that is zero division error
or arithmetic expson. So for that, we are going to see an example so you have to type the value A equal to ten and then int
B equal to zero. So I'm going to print the value with the arithmetic
operator division. So you have to type
system dot out dot print of A, divide B. So if I run the code, if I save and run the code, so you can see in the output. So I'm going to clear
the screen first, and then again, I'm
going to run the code. So you can see
arithmetic excepts, that is zero division
excepts and occurs. So excepts are main
thing which can be handled using the
tricATFinali blocks. So we are going
to see an example for the try catch finally block. So try is nothing but
whatever exbton is occurred, we are not going to print
that expson in the output. So for that, you
have to use the try. So you try. So inside the try, you have to type the exubstans. So you have to type
the Carli brackets. Inside that, you have
to type the exubstan. That is arithmetic exception. So after try, you have
to type the CATs block. So catch block is nothing, but it will print whatever exception will
occur in tri block. So if the exception is
arithmetic exception, it will print arithmetic
except and occur. So that's the use of CATs block. Whatever exception will occur in Tri Block will be
printed by CATs block. So you have to type CAT, and then you have
to type exception. And then variable E. E is the value which is
source the exerption. So E is the variable which
is sows the exaption. So inside the clatch block, you have to print the
exception for printing that to type of dot print LN of E, you have to type the variable. He will print
arithmetic exception. So at last, you have
to type final block. Final block is nothing, but it doesn't care about
whether aapson occur or not. It will print whatever value
generated in its block. So you can see finally block
is generated or executed. You can type your own values. So try which tries the output. Whether exception occurs or not, it will try the output. Catch will source what exception
will occur in tri Block. So cat source what exception
occur in the tri block. So final is nothing, but it doesn't care about
exception occurs or not. It will print whatever value we are typed in
inside the block. So after that, you
have to run the code, you can see the
arithmetic exception occurs using the catch block. So Catblock shows what type
of exception will occur. And then finally block, it doesn't care
about the exception. I will print what
value in the block. So that's it in today's class
we'll discuss about try CAT finally blocks in
exception handler.
17. Java Project and Conclusion: Welcome, everyone.
In today's class, we are going to create
a mini project. So our mini project will be BMI calculation using Java
programming language. So first, you have to create
a class for our project, Bubl class, you have to
type your class name BMI. So BMI is nothing
but body mass index. So we're going to calculate
our body mass index. So after that, you have to
create a main function, bubblic static void
main of Shing ARGs. So that's the main function. And then you have to
type curly brackets. Inside that, you have to type your BMI calculation project. So for the BMI, we are going to need the help of height and weight
of the person. So we are going to
create a height and weight so for the weight, we are going to use double. That's the data type. Double is nothing
but point value. So double weight equals 60. So you can type your point
value or whole value. And then double height. So can type your height
in meter 1.7 meters. And then you have to type
the formula for BMI. So you are to type the
formula double BMI. You can type your
own variable name, double BMI equal
to weight divide, weight divided by
height in the height. So that's the formula for BMI. You have to remember
the formula weight divided by height into height. Height is 1.7, 1.7 into 1.7, weight is 60, 60/1 0.7 into 1.7. So that's the formula for BMI. So after that, I'm going
to print the value of the BMI from the far mul, so you have to print
the value of BMI. So after that, I'm going to use the conditional statements to determine the person
is overweight, normal weight, and
then underweight, based on the BMI value. So if the BMI is less than 18, so the person will be
considered as underweight. So for that you ought to type the system dot out dot print LN of auto type underweight. So after that, I'm
going to type else if, so the second condition will be BMI greater than or equal to 25. If the BMI is greater
than or equal to 25, so the person will be
considered as overweight. And then last condition
that is else. So if the person is more
than 25 or more than 30, they will be
considered as obesity. Obesity is nothing
but overweight. Print LN of obesity. So for the normal, you have to type the function again, the conditional function, else if and then the
condition will be M equal to equal to or greater
than or equal to 18. The person will be
considered as normal weight. So you have to take
normal weight. So these are all the
conditional statements for the BMI calculation. So for BMI calculation, you ought to remember
height and weight, and then you to
remember the formula. So the formula is weight
slash height tint height. So after that, you have to run the code to see the output, you can see 20.7 or then
you can see normal weight. So that's it. In today's class, we are discussed
about body marks, index calculation, mini project using Java
programming language. So our project is
completed successfully, and also our class is
completed successfully. Hope you learn something
from this course. Hope I can see you in the
upcoming courses teached by