Stats: 3,189,252 members, 7,936,824 topics. Date: Sunday, 01 September 2024 at 01:22 AM |
Nairaland Forum / Jas80's Profile / Jas80's Posts
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (of 11 pages)
![]() |
Nelx: That is true sha. Anyways, it is just a website were u make money by reading and commenting on news online |
![]() |
Haywhybaba007:ur number is not on WhatsApp |
![]() |
Good morning everyone, I just found a way you can be making 500 naira daily on the internet doing little task. Drop ur phone number if you are interested I will add you a WhatsApp group |
![]() |
Donhezzy: Please don't continue, e don do 4 Likes |
![]() |
[b]If else statement this statement has two options, one of the option is that our program should do this if the statement is correct, the other option is that our program should do something else, if the expression is not correct. public class Example { public static void main (String args []){ int result=30; if (result<50){ System.out.print("student failed" ![]() else{ System.out.print("student passed" ![]() } } } Output: student failed Let's try something else. public class Example { public static void main (String args []){ int result=70; if (result<50){ System.out.print("student failed" ![]() else{ System.out.print("student passed" ![]() } } } Output: student passed Hope you understood what happened |
![]() |
Waiting for your answers. Another important concept in java is the if statement, if...else statement, if ....else if statement. if statement Basically, this statement is used to check whether an expression is correct or not. If the expression is correct it returns true but if the expression is wrong it returns false. It is used to execute a statement if the expression is true. For example. public class Example { public static void main (String args []){ int result=30; if (result<50){ System.out.println("this student failed the exam" ![]() } } } The output of the above program will be:this student failed the exam. Explanation From the above, the value of result is 30, and in our if statement, we asked if the value of result is less than 50, our program should display "this student failed the exam". 30 is lesser than 50, so this statement is correct, hence our expression will be executed. Understand? |
![]() |
Another important operator in java is the modulus operator (%). As you can see, this operator is represented using the percentage symbol. This operator returns the remainder of a value after division. For example, 5%4, will return 1, because 4 will go into 5 once, and the reminoder will be 1. 10% 6; will return 4, because 6 can go into 10 only once and the remainder will be 4. So, that is that for the modulus operator. Exercise: public class Example { public static void main (String args []){ int a=5; int b=3; a%=b; System.out.println(a); } } Drop the answer below. |
![]() |
Let's take a look at some other operators. public class Example { public static void main (String args []){ int a=20; int b=30; a+=b; System.out.println(a); } } The output of the above program will be:50. How? The += operator add the value of the right hand expression to the initial value of the left hand side expression. From the program, initially, a was 20, and b =30. But from our program, we used the += operator. So, the value of be is added to the value of a public class Example { public static void main (String args []){ int a=20; int b=30; a-=b; System.out.println(a); } } The value of a will be -10. public class Example { public static void main (String args []){ int a=20; int b=30; a*=b; System.out.println(a); } } The value of a will be 600. Hope you get the logic behind the programs above. Ask your questions 1 Like |
![]() |
Good afternoon y'all Last time we talked about the "and" and "or" operator, there are several other types of operators in programming. Maybe we will talk about some today. Some words of wisdom before we start The beauty about learning a programming language is that, you can use the experience you get from it to work with other programming languages. For example, all programming languages uses stuffs like loops, statements, arrays e.t.c We all know all the advantages associated with being a programmer, so I advise you to never give up on the language even when you are finding it difficult to understand. All you have to do is, relax and come back at it with all you have got. Let's go |
![]() |
Nice one 1 Like |
![]() |
Was serious watching this video hoping to see overload, my brothers I no see any overload for here o |
![]() |
Oga giwoni, dis ur matter don reach front page o, I greet o |
![]() |
coronavirus19: This guy I know you |
![]() |
greatResearcher come and add this guy to your list 13 Likes |
![]() |
GreatResearcher: If you can't help, abeg try and mind your business na, wanna-be alpha 1 Like |
![]() |
Ladylite: What are you angry about beauty? Are you hungry?....... By the way give me an example of "better things" |
![]() |
We are always attracted to people who will think are doing okay in life, everybody wants someone that can take them to the next level. Most of the times, the reason you don't get laid is because the girl thinks she can't get anything from you, she thinks you have nothing to offer. We have read several post here about people's girlfriends sleeping with guys they just met. All these things happen mainly because these girls see this new guy has someone who has everything going on for them. In Nigeria, when you are broke, you are regarded as lazy, when you are rich is the other way round. When your girlfriend meet a guy doing better than you in all aspect of life, she starts feeling you are not good enough for her. She might sleep with this guy, even without the guy asking her out. Guys who are doing well in life will often get laid regularly, unless of cause they act needy. Bro, rich guys don't toast girls. Na girl dy chase them. Bro if you don't work on yourself, that your dovy-dovy relationship will soon hit the rock. Everybody wants someone who will take them to the next level. Let's be sincere, looking at your life now, if you were a girl, would you want to bleep you? Talk true. A girl will only cheat on you because there is something she sees on the other guy that she is not seeing in you. It may be handsomeness, brain, built, talk, confidence, the list goes on. Your girlfriend can have a meet a guy today and get so attracted to you, to the extent that she will think about him even when she is with you. When a girl gets so attracted, just know that you might get laid within a week, don't get too carried a way, you will only get laid when you don't mess it up. Work on yourself and this will naturally happen. How do you work on yourself? 1. You read books 2. Work on your appearance. Is that your haircut really ok?, Are those clothes you are putting on up to date, do you smell nice, put ur appearance in order. Dress the way you want to be addressed. 3. Chase your passion don't chase girls. 4. Have plans on how to make money. I am not saying you should make money because of girls, make money because of yourself. You must have heard of Dubai, Paris, Ibiza, and other beautiful place, my guy, u no wan explore the world, na Nigerian abi Africa you wan die put?......abeg o Change your way of life and your life will change. I have used more than half of my time to write about how important it is to be a better person. Another reason why you might not get laid is because you are too needy, you must have gotten tired of hearing this, but it is the truth, even as a rich guy, if you are needy nobody will want to bleep you. Neediness is a total turnoff for everybody on this planet. Abeg, my guys I don tire, but all this bloggers dy try o 2 Likes |
![]() |
So, try the above codes and get back to me. That's all for now. Ask your questions 1 Like |
![]() |
The || operator (or operator). This operator returns true if both expressions or only one expression is true. It returns false only when both expressions are wrong. For example. public class Check { public static void main (String args[]){ int a =20; int b=15; System.out.println(a>5 || b<10); } } The output of the above code will be true. Because the first expression is true, a is 20, 20 is greater than 5, so this expression is correct. Our second expression is wrong because b is 15, and 15 is greater than 10. Note, this operator is also called the or operator. It returns true if one of the expression is true, and returns false when both expressions are false |
![]() |
So, in our last post, we talked about arithmetic operators, and we also wrote a simple interest program, using the arithmetic operators. Today we are going to be be talking about logical operators. Logical operators are very useful operators you are going to need for your java programs. Below are some examples of logical operators. The & Operator: This operator checks two expression and returns true if both expressions are correct. For example, let's consider the program below. public class Check { public static void main (String args[]){ int a=20; int b= 30; System.out.println(a<b && b>20); } } The output of the above program will be true. Because our variables a and b has the value of 20 and 30 respectively. from our expression, a<b, is correct because a =20 and b= 30, 20 is less than 30, so our first expression is true. Our second expression says b>20, this is also true because 30 is greater than 20. Hence, the output : true. Note that, the && operator returns true only when both expression is true. Otherwise it returns false. That is to say that, it returns false when only one condition is true and returns false also when both expressions are false. |
![]() |
Good evening everyone, it has been a while. I have been too busy. For those of you who are still interested I will be continuing from were we stopped |
![]() |
I don't just understand guys on this romance section. Don't you guys learn from the mistakes others have made?. You must have heard times without number that you should never ask a girl out? And you still went ahead to ask her out, why? Because you think your case is different. Well done sir. My only advice is that you should forget about her. Try and work yourself, read books, watch movies and play video games, listen to musics. Stop chatting with her because that will only make make you stick around. Oga, abeg listen to the advice when I give you so o, if you like still go dy call her, na u know.....I don go 1 Like |
![]() |
Hello guys, who is still interested in learning java, it has been a while 2 Likes |
![]() |
Please I am looking for an apartment in ejigbo,canoe-ajao axis mushin, reply this message if you have any idea of who I can contact.,....abeg na better self contain o, |
![]() |
Please I am looking for an apartment in ejigbo,canor-ajao axis mushin, reply this thread if you have any idea of who I can contact.,....abeg na better self contain o 1 Like |
![]() |
Am looking for an apartment in ejigbo,canor-ajao axis mushin, reply this thread if you have any idea of who I can contact.,....abeg na better self contain o |
![]() |
[quote author=codedtony post=85901433][/quote] Ok |
![]() |
codedtony: You don't need to bind it |
![]() |
Note that, Java is case sensitive, meaning that, Jas is different from jas, e is different from E, so check your variables |
![]() |
Pls note I am using my phone for the tutorial this afternoon, so pardon my typos, if any ( am telling u because of all this nairaland programmers). Explanation of the code: I told before that our variables must be assigned a data type. Our variables are p,r,t (which are the principal, rate and time respectively). And si(simple interest) which will hold our simple interest after calculation. Note that the data type given to prt is the int data type. Remember that 2, 10 and 11000 are whole numbers. But our si is double because simple interest usually ends up with decimal numbers after calculations. We don't know what our answer will be, so we have to use the double data type if at all the answer will be a decimal number. So, the data type u assign to a variable depends on the value of that variable. So if at all you know the answer for the simple interest above will be 2200, then you can assign the data type of "si" as int because 2200 is a whole number. NOTE: there is something known as data type compatibility, don't assign data types anyhow 1 Like |
![]() |
Good afternoon, hope you all are fine?.....let's continue from were we stopped. Let's look into the data types in java. A simple interest program(formula is PRT/100) public Simple interest{ public static void main(String [] arts){ int t=2; Int r=10; int p=11000; double si=(p*r*t)/100; System.out.println("the simple interest is:" + si); } } Output: the simple interest is: 2200.0 1 Like |
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (of 11 pages)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 77 |