Language Essentials I

31 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€47.98
List Price:  €67.18
You save:  €19.19
£39.89
List Price:  £55.86
You save:  £15.96
CA$69.90
List Price:  CA$97.87
You save:  CA$27.96
A$76.87
List Price:  A$107.62
You save:  A$30.75
S$67.31
List Price:  S$94.24
You save:  S$26.93
HK$389.14
List Price:  HK$544.83
You save:  HK$155.68
CHF 44.67
List Price:  CHF 62.54
You save:  CHF 17.87
NOK kr553.51
List Price:  NOK kr774.97
You save:  NOK kr221.45
DKK kr357.84
List Price:  DKK kr501
You save:  DKK kr143.16
NZ$85.68
List Price:  NZ$119.95
You save:  NZ$34.27
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.46
৳5,972.22
List Price:  ৳8,361.58
You save:  ৳2,389.36
₹4,221.07
List Price:  ₹5,909.84
You save:  ₹1,688.76
RM223.35
List Price:  RM312.71
You save:  RM89.36
₦84,627.22
List Price:  ₦118,484.88
You save:  ₦33,857.66
₨13,887.22
List Price:  ₨19,443.22
You save:  ₨5,556
฿1,722.96
List Price:  ฿2,412.28
You save:  ฿689.32
₺1,727.27
List Price:  ₺2,418.32
You save:  ₺691.05
B$289.99
List Price:  B$406.01
You save:  B$116.02
R905.58
List Price:  R1,267.89
You save:  R362.30
Лв93.83
List Price:  Лв131.37
You save:  Лв37.54
₩70,211.45
List Price:  ₩98,301.65
You save:  ₩28,090.20
₪185.06
List Price:  ₪259.10
You save:  ₪74.04
₱2,946.36
List Price:  ₱4,125.14
You save:  ₱1,178.78
¥7,736.95
List Price:  ¥10,832.35
You save:  ¥3,095.40
MX$1,021.22
List Price:  MX$1,429.79
You save:  MX$408.57
QR182.26
List Price:  QR255.18
You save:  QR72.92
P683.46
List Price:  P956.90
You save:  P273.44
KSh6,472.14
List Price:  KSh9,061.51
You save:  KSh2,589.37
E£2,482.01
List Price:  E£3,475.01
You save:  E£993
ብር6,118.22
List Price:  ብር8,566
You save:  ብር2,447.77
Kz45,640.87
List Price:  Kz63,900.87
You save:  Kz18,260
CLP$49,324.13
List Price:  CLP$69,057.73
You save:  CLP$19,733.60
CN¥362.07
List Price:  CN¥506.93
You save:  CN¥144.86
RD$3,012.01
List Price:  RD$4,217.06
You save:  RD$1,205.04
DA6,712.40
List Price:  DA9,397.90
You save:  DA2,685.50
FJ$113.77
List Price:  FJ$159.29
You save:  FJ$45.51
Q385.78
List Price:  Q540.13
You save:  Q154.34
GY$10,455.70
List Price:  GY$14,638.82
You save:  GY$4,183.11
ISK kr6,982.60
List Price:  ISK kr9,776.20
You save:  ISK kr2,793.60
DH502.76
List Price:  DH703.91
You save:  DH201.14
L910.90
List Price:  L1,275.33
You save:  L364.43
ден2,951.80
List Price:  ден4,132.76
You save:  ден1,180.95
MOP$400.70
List Price:  MOP$561.01
You save:  MOP$160.31
N$906.31
List Price:  N$1,268.91
You save:  N$362.60
C$1,838.97
List Price:  C$2,574.70
You save:  C$735.73
रु6,749.45
List Price:  रु9,449.77
You save:  रु2,700.32
S/189.51
List Price:  S/265.32
You save:  S/75.81
K201.21
List Price:  K281.71
You save:  K80.50
SAR187.68
List Price:  SAR262.77
You save:  SAR75.08
ZK1,382
List Price:  ZK1,934.92
You save:  ZK552.91
L238.86
List Price:  L334.42
You save:  L95.56
Kč1,216.06
List Price:  Kč1,702.59
You save:  Kč486.52
Ft19,746.05
List Price:  Ft27,646.05
You save:  Ft7,900
SEK kr551.69
List Price:  SEK kr772.42
You save:  SEK kr220.72
ARS$50,182.44
List Price:  ARS$70,259.44
You save:  ARS$20,076.99
Bs345.34
List Price:  Bs483.50
You save:  Bs138.16
COP$219,443.60
List Price:  COP$307,238.59
You save:  COP$87,794.99
₡25,456.77
List Price:  ₡35,641.51
You save:  ₡10,184.74
L1,262.95
List Price:  L1,768.23
You save:  L505.28
₲390,155.46
List Price:  ₲546,248.87
You save:  ₲156,093.40
$U2,130.69
List Price:  $U2,983.14
You save:  $U852.45
zł208.13
List Price:  zł291.40
You save:  zł83.27
Already have an account? Log In

Transcript

Okay, so I in this chapter we are going to look into the Java programming language essentials one. Okay. In this chapter we are going to learn to programming console program and we are going to go into the past of Java, then the variables and data types, the arrays, the data manipulation and data types conversion. So a console program application that runs in the MS DOS mode is the most basic program you have creating in C or c++ programming generally focus on console applications. While Java programming IDs like NetBeans have impressive UI design for learning the basic rules in the Java course we focus on developing the console program instead of the windows form applications. So, console program, although USBC offers the following advantage, high performance has bought fast prototyping and testing of ideas and logic before proceeding into developing the windows form applications for myself I usually when in the process of developing compressed windows form application, I will use a console application to test the algorithms and other code fragments.

So, a console program So, for this one, we will create a simple Hello World program so, By the NetBeans ID Something like this. Okay, import Java dot util, the scanner. The packet pick Ba, Java da, da da scanner input from the user. So we're going to create a scanner SC corny Okay Hello World please enter into so IRA into a meeting see 12345 and then you will print out the input 12345 and asked me to enter any key to z so I press star d and then enter geyser the whole program okay so in this Java programming in these Java programming y'all have the we understand the cause now so in Java application usually we have a user input every process the input and then we output a result. So in console program development the following commands to read the input. So to read the input we have to create a scanner object.

So scanner SC equal new scanner system dot We will need to import the Java dot util dot scanner class. And then SC dot next is a method that reads the next token from the user input. sc dot next line is a method to read the next line of characters from the user input. So, System dot out dot print string object. Some string variable is a method to write tests on the console screen, System dot out dot print line is to write and test on the on the console screen by a half a new new line. Okay, so after we run the code you can get something like just no Have you seen the NetBeans okay after we run, so We bring on the console screen Hello.

Then press Enter input then I enter 12345 and then I print the input I enter 12345 and then asked me to press any key to Z and then I press a D and then he has a the program. Okay, so uh, in this program in this course here, so we have a scanner object, scanner S equal new scanner system.in so we printer hollower. So we print a lower and we print, press Enter input, so we print, press Enter input. There, we we get used input. So SC dot nice, okay. So sc donessa when I will say when the user enter 12345 sC Don si will give us written as a string value of 12345.

And I studied string value into the variable SDI input. Okay. Then we have a system dot out dot println I print the user input, which is 12345. Then we print again gonna press enter any key to exit, press enter any key to exit and so on. So when the user press D and enter here as a program, okay, so in this coding digest I have already explained to you NetBeans so import Java dot util dot scanner is to import a scanner libraries. scanner SC equal new scanner system.in is to create a scanner object.

System dot out dot print line Hello, we display our Hello on screen. Then system dot print, press inputs demo enter input sorry display, press Enter input on the console screen. String str employ SC Donnie. So SC bonus will return us or give us the user input in the string data type. And then I store the user input in this variable str input. Okay, we talked about Variable Data time data, then System dot out dot println I SDI input we display our wise and wise the input from the user.

And that is roughly why what the program does. Okay try modifying the System dot out dot println night or System dot out dot print to observe what are the difference okay so let's see instead of using a System dot out dot println Why don't I change it to System dot out dot print? Okay, so now let's see why the difference okay so he still bring Rafi the same format here okay So there is no no much difference by write print line we have a new line by in this case inside the printer automatically print a new line in the press Enter input Okay. See the next slide okay so I in this slide, we are talking about a parcel of Java. So, in the Java or grandma Java follow the Java cross. So we have a package hello welcome.

So, now we have import Java dot util dot scanner. This is the import library cross. Then we have cross here public cross Hello well console you We have a method then we have a comment. So comments can be a double slash. Yes. So comments are something that the Java interpreter compiler will not you will not make these as will not treat this as a cosa so we adjusted is something like the Costco run ice cube.

Okay. So in Yeah, explain more detail about them. So in customer tell the compiler where to look for the cross or library or package you refer in your current code package is a way to organize your code so that our compiler can file the fight process across the file finds a new cross. I will say meta is a question. So, specify the functionality of the cross, then commence a statement that begins with double forward slashes that are not going to be run or executed by the compiler or the program. So, now we talked about variables.

So, a variable is something we create like I will say is like some container to store some value. So, in Java program, we have variables and data types. So variables is the container to store the value. Then data types is is used seals to describe our determiner what tell to string the variables okay. So the syntax to declare a variable is our data type, variable name equal values or data type variable name, then variable name equals some values. So, in our course we declare string str input equals SC Don this SC dot nissa t pasta user info why why the user have entered and you give us a value or a value in the string data type.

So we declare a string, then a variable. So I declare a string variable, a variable of string data type. Okay, to start to to start this value from the user input. So, in the Java programming we also have the escape escape sequences. So in System dot out dot println IV can have slash n slash n slash t. So slash n means new light, slash t means horizontal tab. double slash means backslash slash quotation, I mean single quotation slash double quotation means double quotation, okay.

Uh, data types, we have integer data types. So, this is, I will say this is a range, so, integer is some value that does not how I got SEMA. Here we have long and this is the range Then we have Boolean we only have true or false. Now we have characters go Nia, a single character. Now we have throat. So this is the range.

So fruit can have decimal point then we have string string, can I have a new slang? He is a text okay. Okay arrays are special types of variables to store values. So, he is usually used for dealing with cell values or same data types just a square bracket to the data type as shown below. So, to create a array Okay, so we put our integer square bracket a, so our array is actually a variable to start a cell value so, can start a lot of values. So if let's say I have a integer square bracket a, so I have a array A of the integer data type.

So a array A can store a lot of integer values. Okay. So we have our integer, square back equal new integer tree. This tree means that we saw tree values we can only allow the array to store tree back values. So, we create an integer square bracket a canoe integer square bracket tree, so we can put the values into the array by stating a zero equals one, a one equal to a two equals three Okay all we can create something like this integer square bracket a Pico new integer square bracket 123 to retrieve an array so we can do something a square bracket one and then to get an array size we can do something like eight.nine.to string okay. So lessons wise the array okay I complete this program first okay so we have this one is all program so string str employment See down there.

So this is the variable of string data type and we store the string value, which is a user input. So now I create a new array. Okay. So let's say I create an integer A equals c 123. Okay, so to get a first hand Eman to get a one. So I put a zero T is also system.

No, oh, no. Lie. Okay. Okay, so I can Run the program in C. So I get a one okay if I change this to a one so I oh yeah the two okay. So yeah if I change this to to the animal okay. So in array I will say that to get the first element we use zero k in the world The first element I will say the number or the element number will be zero.

So to get a second element element number will be one together element element number will be two okay. So I will say this is roughly how the array works okay, so he let's see I do the other way I use integer square bracket equal new, new integer okay okay I have to specify a tree here. So tree means that I only want this array to store Nia tree element Okay. So, a zero the first element will be one a one second element will be two. So a two element will be three. So I saw three, I will say values into this array, integer array A.

Okay. So if I do System dot out dot println I, I will say you're still the same. Okay, so this is the array in Java Okay, so Let us modify the Java program we created previously. So now I'm going to create a calculator okay. So I say I will create the scanner object SC, print the ah calculate string here my first console calculator slash n slash and some slash n equals equals session and I will print Please enter your first number. Now I don't get your first ha, first number.

Now a prenup is input second number and get your second number. Now we'll come buddy number from string to double data Type okay then I will do a addition of these two number then I will convert these double, double data type to integer and then I will show result for two, two of these result, okay one I will show you is Da, da ba, one of the data type. The other one I will show you is integer data type, okay. That'll print the result to have a press any key to continue

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.