Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Yesterday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Java lesson 1.0.1.5
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="ravicplk" data-source="post: 2169271" data-attributes="member: 54446"><p><strong>Hello there my friends! How is everything going? I hope that everything is going fine. First little reminder to all of you, be careful when u are traveling in a public transport service. And don’t stay in busy areas for nothing. Coz bombs are every where. And sorry for the delay.</strong></p><p><strong></strong></p><p><strong>Ok now lets move on to our lesson. In the last lesson we learnt about data types. Think u remember that</strong></p><p><strong>There are 8 main data types and they are byte, short, int, long, double, float, char, Boolean, </strong></p><p><strong>I think u can remember those things.</strong></p><p><strong></strong></p><p><strong>Ok now lets talk about today’s lesson-1 . </strong></p><p></p><p><span style="font-size: 15px"><u>LITERALS</u></span></p><p><span style="font-size: 15px"><u></u></span></p><p><span style="color: DarkRed">1)</span></p><p><span style="color: Black"><strong>So as u know there are sooo many values included in a single program. Not only in Java, in any program there are values included in them. Hey, what came to u r mind when I said values. I know u only think about 1,2,3… nee. Why the hell is that, we think only about numbers ,when we heard the word “value” . Must be a mind thing. Anyway when we say values we can include many things to it. I don’t know in other subjects, but in programming the word value is used to so many things.</strong></span></p><p><span style="color: Black"><strong></strong></span></p><p><span style="color: DarkRed">2)</span></p><p><strong>So can u guess the values in programming? As we discussed earlier we have numbers, then we have character values, boolean values such as true and false. And finally we have string values. Let’s talk about these things in detail in a minute. So all these values represent themselves in a program. Hmmm….. you might be saying”what the hell is that he said” . Forget it guys. Let me explain it with a example. Ok. Lets see…ahaaaaa got one. So in EK there are sooo many members. Lets think of one. Hmm.. “Xpert ayya” ,</strong></p><p><strong>Why the hell he came to my mind..ahaa..coz he is the one inspired me to do these threads.</strong></p><p><strong></strong></p><p><strong>So think about xpert ayya. He is the only xpert in EK. Xpert is a constant thing(rather a person) in EK. And always he represent him self, that mean that he is not a puppet like thing. So if we compare that example with a program, EK is the program and Xpert is the literal. Hmm not the best example. If u don’t understand the concept please post.ok.</strong></p><p></p><p>(guys who don’t know about Xpert ayya may think who the hell he is, he is a senior member of EK and a good friend, hope u got that)</p><p></p><p><span style="color: DarkRed">3)</span></p><p><strong>Ok here is another example.</strong></p><p><strong>Think of integer value “7”. The value of “7” won’t change in any stage of the program. I think u got it now.</strong></p><p></p><p><span style="color: DarkRed">4)</span></p><p><strong>So a constant value in a program is denoted by a literal. That is the summary of all the bla bla things in above passages,</strong></p><p></p><p></p><p><span style="color: DarkRed">5) </span></p><p> <strong>So as I said in the 2nd paragraph the constant values or the literals can be categorized in to several groups. I think u already know about these groups and I am not going to explain much about those things.</strong></p><p><strong>Integer literals</strong></p><p><strong>Eg. 23, 545, 6556,-454</strong></p><p><strong></strong></p><p><strong>Floating point literals</strong></p><p><strong>Eg. 0.23, .535, -0.5343</strong></p><p><strong></strong></p><p><strong>Boolean literals</strong></p><p><strong>Eg. TRUE,FALSE</strong></p><p><strong></strong></p><p><strong>Character literals</strong></p><p><strong>Eg. ‘X’ , ‘r’ , ‘(‘</strong></p><p><strong></strong></p><p><strong>String literals </strong></p><p><strong>Eg. “hello world”</strong></p><p> <strong></strong></p><p><strong> Hope u understand about the literals. Hee heeeeeee..may be u will think that’s all for today’s lesson. Nope. Today’s lesson is a biggy and now lets see u can remember the earlier lessons.</strong></p><p><strong>So what is a variable in a program?</strong></p><p><strong>Hmmmm…………….can u remember it. Hope u can remember that. </strong></p><p><strong>The variable is a memory location that stores a unit of data in a java program. So variable is defined by the combination of a identifier, a data type, and optional initializer. And all variables have a scope. I think u know about scope right. It is the domain of a variable.</strong></p><p><strong></strong></p><p><strong>Ok now we are moving on to the variable declaration. I think we did this practically in our earlier lessons. But let’s see what it is in detail.</strong></p><p><strong></strong></p><p><strong><span style="color: DarkRed">6)</span> Variable Declaration</strong></p><p><strong></strong></p><p><strong>So u know what is a variable, so before u use a variable in a java application u must declare it. So what is declaring?</strong></p><p><strong>Actually u have to introduce the variable to the java application before u use it,</strong></p><p><strong>E.g.</strong></p><p> <strong>So u are going to a new company. Ok. Then u are asked to introduce u r self to the other employers in that company. So how are u going to introduce u r self. First u may be say u r name,</strong></p><p><strong>“I am Ravi”</strong></p><p><strong>Then what. You are in a company right, so secondly u are going to say in which department u are working,</strong></p><p><strong>“I am working in the programming department”</strong></p><p><strong>So like that u are going to introduce u r self in to the crowd. When u are introducing u r self in to the crowd u are not going to tell all the bla bla bla things about u. only the most important things. </strong></p><p><strong></strong></p><p><strong>So that example is about introducing a person. Similarly, we have to declare the variable </strong></p><p><strong>in to a java application. Like in the example u have to give the name, type and also a value for the variable. So in java “identifier” is the name of the variable. You can see the basic variable declaration form below.</strong></p><p><strong></strong></p><p><strong>type identifier [=value];</strong></p><p> </p><p><img src="http://img136.imageshack.us/img136/152/67479780am0.gif" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><strong>So why u think that [=value] part is inside a square brackets, because it is optional. Ahaaaaaaaa heard about the optional initialization previously in this lesson. Check out last part of the 5th para. The thing is u can assign a value for the variable at the declaration point and also u can assign a value for that in the middle of the java code. So it is optional thing to assign a value in the beginning. Let’s get an example, and then u will understand it easily.</strong></p><p><strong></strong></p><p><strong>int x; ----------------this declares int variable x</strong></p><p><strong>int x=12;------------this initializes x</strong></p><p><strong></strong></p><p><strong>I think u understand about it.</strong></p><p><strong></strong></p><p><strong>So there are some important things u have to know when u are naming a variable. That means u can’t use anything for an identifier. There are three main roles u have to follow when naming an identifier,</strong></p><p><strong></strong></p><p><strong>1) The identifier may only contain simple and capital letters[a-z , A-Z] , digits [0-9], the dollar mark [$] and the underscore[ _ ]</strong></p><p><strong></strong></p><p><strong>2) An identifier cannot start with a digit.</strong></p><p><strong></strong></p><p><strong>3) Keywords cannot be used as an identifier.</strong></p><p><strong>(there are some keywords in java which are used to perform some activities. As an example think about “int”. “int is used to inform the data type.)</strong></p><p><strong></strong></p><p><strong>So that’s all about variable declaring. Hope u got something out of the lesson. Post u r comments and questions. </strong></p><p><strong>Aaaaaah forgot to say next lesson will come with a hi quality video and it’s a practical lesson.</strong></p><p></p><p><em><span style="color: DimGray"> ………………Adios amigos ………………..(he heee good bye friends in spanish)</span></em></p></blockquote><p></p>
[QUOTE="ravicplk, post: 2169271, member: 54446"] [B]Hello there my friends! How is everything going? I hope that everything is going fine. First little reminder to all of you, be careful when u are traveling in a public transport service. And don’t stay in busy areas for nothing. Coz bombs are every where. And sorry for the delay. Ok now lets move on to our lesson. In the last lesson we learnt about data types. Think u remember that There are 8 main data types and they are byte, short, int, long, double, float, char, Boolean, I think u can remember those things. Ok now lets talk about today’s lesson-1 . [/B] [SIZE="4"][U]LITERALS [/U][/SIZE] [COLOR="DarkRed"]1)[/COLOR] [COLOR="Black"][B]So as u know there are sooo many values included in a single program. Not only in Java, in any program there are values included in them. Hey, what came to u r mind when I said values. I know u only think about 1,2,3… nee. Why the hell is that, we think only about numbers ,when we heard the word “value” . Must be a mind thing. Anyway when we say values we can include many things to it. I don’t know in other subjects, but in programming the word value is used to so many things. [/B][/COLOR] [COLOR="DarkRed"]2)[/COLOR] [B]So can u guess the values in programming? As we discussed earlier we have numbers, then we have character values, boolean values such as true and false. And finally we have string values. Let’s talk about these things in detail in a minute. So all these values represent themselves in a program. Hmmm….. you might be saying”what the hell is that he said” . Forget it guys. Let me explain it with a example. Ok. Lets see…ahaaaaa got one. So in EK there are sooo many members. Lets think of one. Hmm.. “Xpert ayya” , Why the hell he came to my mind..ahaa..coz he is the one inspired me to do these threads. So think about xpert ayya. He is the only xpert in EK. Xpert is a constant thing(rather a person) in EK. And always he represent him self, that mean that he is not a puppet like thing. So if we compare that example with a program, EK is the program and Xpert is the literal. Hmm not the best example. If u don’t understand the concept please post.ok.[/B] (guys who don’t know about Xpert ayya may think who the hell he is, he is a senior member of EK and a good friend, hope u got that) [COLOR="DarkRed"]3)[/COLOR] [B]Ok here is another example. Think of integer value “7”. The value of “7” won’t change in any stage of the program. I think u got it now.[/B] [COLOR="DarkRed"]4)[/COLOR] [B]So a constant value in a program is denoted by a literal. That is the summary of all the bla bla things in above passages,[/B] [COLOR="DarkRed"]5) [/COLOR] [B]So as I said in the 2nd paragraph the constant values or the literals can be categorized in to several groups. I think u already know about these groups and I am not going to explain much about those things. Integer literals Eg. 23, 545, 6556,-454 Floating point literals Eg. 0.23, .535, -0.5343 Boolean literals Eg. TRUE,FALSE Character literals Eg. ‘X’ , ‘r’ , ‘(‘ String literals Eg. “hello world” Hope u understand about the literals. Hee heeeeeee..may be u will think that’s all for today’s lesson. Nope. Today’s lesson is a biggy and now lets see u can remember the earlier lessons. So what is a variable in a program? Hmmmm…………….can u remember it. Hope u can remember that. The variable is a memory location that stores a unit of data in a java program. So variable is defined by the combination of a identifier, a data type, and optional initializer. And all variables have a scope. I think u know about scope right. It is the domain of a variable. Ok now we are moving on to the variable declaration. I think we did this practically in our earlier lessons. But let’s see what it is in detail. [COLOR="DarkRed"]6)[/COLOR] Variable Declaration So u know what is a variable, so before u use a variable in a java application u must declare it. So what is declaring? Actually u have to introduce the variable to the java application before u use it, E.g. So u are going to a new company. Ok. Then u are asked to introduce u r self to the other employers in that company. So how are u going to introduce u r self. First u may be say u r name, “I am Ravi” Then what. You are in a company right, so secondly u are going to say in which department u are working, “I am working in the programming department” So like that u are going to introduce u r self in to the crowd. When u are introducing u r self in to the crowd u are not going to tell all the bla bla bla things about u. only the most important things. So that example is about introducing a person. Similarly, we have to declare the variable in to a java application. Like in the example u have to give the name, type and also a value for the variable. So in java “identifier” is the name of the variable. You can see the basic variable declaration form below. type identifier [=value];[/B] [IMG]http://img136.imageshack.us/img136/152/67479780am0.gif[/IMG] [B]So why u think that [=value] part is inside a square brackets, because it is optional. Ahaaaaaaaa heard about the optional initialization previously in this lesson. Check out last part of the 5th para. The thing is u can assign a value for the variable at the declaration point and also u can assign a value for that in the middle of the java code. So it is optional thing to assign a value in the beginning. Let’s get an example, and then u will understand it easily. int x; ----------------this declares int variable x int x=12;------------this initializes x I think u understand about it. So there are some important things u have to know when u are naming a variable. That means u can’t use anything for an identifier. There are three main roles u have to follow when naming an identifier, 1) The identifier may only contain simple and capital letters[a-z , A-Z] , digits [0-9], the dollar mark [$] and the underscore[ _ ] 2) An identifier cannot start with a digit. 3) Keywords cannot be used as an identifier. (there are some keywords in java which are used to perform some activities. As an example think about “int”. “int is used to inform the data type.) So that’s all about variable declaring. Hope u got something out of the lesson. Post u r comments and questions. Aaaaaah forgot to say next lesson will come with a hi quality video and it’s a practical lesson.[/B] [I][COLOR="DimGray"] ………………Adios amigos ………………..(he heee good bye friends in spanish)[/COLOR][/I] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom