how the answer is 13 can anyone explain plz

how the answer is 13 can anyone explain plz

public class that {

public static void main(String arr[])
{
    int i=3;
    int j=1;

    while(i<4)
    {
        //j=i;
        i=i+j/2;
    }
    System.out.println(i);
}

}

View Answers

August 15, 2013 at 1:14 PM

The answer will not be 13.nothing will be printed there, as while loop goes on executing infnitely.Because i=i+j/2;since it executes j/2 first(j value is 1) 1/2 becomes 0.As it is integer.and i value is 3+0=3 and it goes on infinitely.because for all time i value is 3 and 4>3 is true every time.









Related Tutorials/Questions & Answers:
how the answer is 13 can anyone explain plz
how the answer is 13 can anyone explain plz  public class that { public static void main(String arr[]) { int i=3; int j=1; while(i<4) { //j=i; i=i+j/2; } System.out.println(i
plz anyone can solve my
plz anyone can solve my  creat an applet prog which accepts the details of 10 customers like name , address , city , ect. and display it   import java.awt.*; import javax.swing.*; import java.awt.event.*; import
Advertisements
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
can u plz explain the http request methods - JSP-Servlet
can u plz explain the http request methods  can u plz explain http request methods? as well in jdbc...how to delete the duplicate records in database... duplicate entries in the MySQL database we can follow one of these following approach
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz answer - Java Beginners
plz answer   Write a Binary Search program that searches an array of ordered data. Compose an ordered array of 500 integers that contains the following series of numbers and run the search on it: 1, 2, 3, 5, 8, 13, 21, 34, 55
plz give me answer
plz give me answer  Discuss & Give brief description about string class methods   Java string methods
Plz answer - Java Beginners
Plz answer  Create a Java Bean Class â?? Customer according to the below given class diagram. Customer... ------------------------------------------------- plz doreply me....thankz alot  
Plz send me answer quckly
Plz send me answer quckly  Respected Sir, myself is pavan shrivastava.i want ask a question that is ( we can't create object of interface then how would possible to create object
plz. answer my ques - Java Beginners
plz. answer my ques  I want to ask a prog. prob which would create a prog that would simply take username and password as input and will display... such type of program is possible in c.  can you mention technology
need the answer vry urgently..plz help me...[plzzzzzzzz
need the answer vry urgently..plz help me...[plzzzzzzzz  the question......to [email protected]/[email protected]...plz plz...help....me..it can change my lyfe...... useing struts or servlet... in eclipse platform...can any one tell me the source
plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line...,c.Through 'this' keyword,you can refer to any member of the current object from within
Can anyone assist with the coding of this game?
Can anyone assist with the coding of this game?  I am in need of the coding for this game. I need to write a "Hangman" game that will randomly generate a word from a text file and will prompt the user to guess one letter
can any one explain this
can any one explain this  class Clidder { private final void flipper() { System.out.println("Clidder"); } } public class Ex3 extends Clidder { public final void flipper() { System.out.println
can you explain ?
can you explain ?  my dear can you teel me the explaintion for this code i need it GregorianCalendar cal = new GregorianCalendar(y, m, 0...(); } } iam explain whole code exept this part can you help
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
Please , can any one answer this Question?
Please , can any one answer this Question?  How to cummunicate one web application to another web application in different places
can u plz help out how to attach file directly & send to a particular mail id
can u plz help out how to attach file directly & send to a particular mail id  i am building a project online LEAVE MANAGEMENT SYSTEM to our coll... for approval so i need ur guidance how to tackle this problem
can anyone help me to implement strength of the password - Security
can anyone help me to implement strength of the password  hi.. i have to implement password strength detection algorithm. How can i use dictionary in linux system
Explain how you overcame a major obstacle
Explain how you overcame a major obstacle       Qus. Explain how you overcame a major... not brag, just say it in a matter-of-fact tone. This is a key point. 13. How long
What is the answer and how the program work?
What is the answer and how the program work?  public class Threads2... of method."); } } Which two can be results? (Choose two...; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i...;where is the answer sir.? just i want from you to look what is the error plz
hello. can anyone help me with my java project, using jcreator?
hello. can anyone help me with my java project, using jcreator?  this is how it goes.. we are to develop a GUI of a certain form, in my case this one and then i should be able to create, view, search, and save using swamp.. i
it is a linux program is there anyone who can help me out with it?
it is a linux program is there anyone who can help me out with it?  Write a Bash script that prompts the user for a user-ID and displays the corresponding userââ?¬â?¢s login name, ownerââ?¬â?¢s name, and his/her home directory
it is a linux question is there anyone who can help me out with it?
it is a linux question is there anyone who can help me out with it?  Write a script that accepts three numbers as parameters. Your script should add the first two numbers together and then call a second script that accepts two
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   The Task Write a class whose objects will represent students...?? otherwise. The overall mark can be calculated by multiplying both
can u plz try this program - Java Beginners
can u plz try this program  Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List Records. Each Record contains: Name(max 100 char), Age, Notes(No Maximum Limit
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   Write a class whose objects will represent students.The class should have three... to 40 and ââ?¬Å?failââ?¬Â? otherwise. The overall mark can
how to get following answer in turbo c program
how to get following answer in turbo c program  input 123456789 output 1 2 3 4 5 6 7 8 9
How to Explain different way of using thread?
How to Explain different way of using thread?  Hi, How to explain how to using different thread in Java program
How to Explain different way of using thread?
How to Explain different way of using thread?  Hi, How to explain how to using different thread in Java program........   Hi, There are different types Thread in Java program. Here is the explain how to using thread
What are events? Explain how Event handling in Java?
What are events? Explain how Event handling in Java?  What are events? Explain how Event handling in Java?   Hi, The Events are the integral part of the java platform. Sometimes we want one object to perform shorten
need source code fir automatic timesheet filling. can anyone peass help?
need source code fir automatic timesheet filling. can anyone peass help?  Hi friends, I wants to develop a software that should automatically fills the time sheet using the login and log out entries. Can anyone please help me
A few questions related to developing a blog....can anyone please help me out??
A few questions related to developing a blog....can anyone please help me out... jsp.I have a few questions.... Can anyone tell me if we can insert images...??If it is possible then how is it done?? If we can insert images in the textarea then how
How many objects are created in the code below? Explain.
How many objects are created in the code below? Explain.  Hi, Here is my code public static void main(String[] args) {String s1 = "abc"; StringBuffer s2 = new StringBuffer(s1); StringBuffer s3= s2; StringBuffer s4 = new
ModuleNotFoundError: No module named 'anyone'
'anyone' How to remove the ModuleNotFoundError: No module named 'anyone'... to install padas library. You can install anyone python with following command...ModuleNotFoundError: No module named 'anyone'  Hi, My Python
ModuleNotFoundError: No module named 'anyone'
'anyone' How to remove the ModuleNotFoundError: No module named 'anyone'... to install padas library. You can install anyone python with following command...ModuleNotFoundError: No module named 'anyone'  Hi, My Python
ModuleNotFoundError: No module named 'anyone'
'anyone' How to remove the ModuleNotFoundError: No module named 'anyone'... to install padas library. You can install anyone python with following command...ModuleNotFoundError: No module named 'anyone'  Hi, My Python
Explain about threads:how to start program in threads?
Explain about threads:how to start program in threads?  import.... It can be called as single unit of execution in a program. A program can have... to type something and show date and time simultaneously you can use threads
NAME SORTING. . .anyone? - Java Beginners
NAME SORTING. . .anyone?  how can I sort names without using the 'name.sort' method? please help. . .anyone? the program should sort the first... friend, Please explain your details for complete Solution. For read
plz help me any one as fast as u can
plz help me any one as fast as u can  A thief Muthhooswamy planned... is the number of metres he can jump (1<=climbUp<=10^10) climbDown... Sample Input 1: 10:1:1:{10} Here Muthooswamy can jump 10 metres height
Explain ServletContext.
Explain ServletContext.  Explain ServletContext.   Hi, Here is the answer,ADS_TO_REPLACE_1 ServletContext interface is a window for a servlet to view it?s environment. A servlet can use this interface to get
plz plz plz inform me as soon as possible
plz plz plz inform me as soon as possible  ``by using c programs how to type
Is there anyone out there?
Is there anyone out there?  Hi please could somebody respond as I am seeking advice but not getting any and do not know whether or not to continue using this site
please reply fast if anyone knows that how to install mysql on windows using msi package
please reply fast if anyone knows that how to install mysql on windows using msi package  please reply fast if anyone knows that how to install mysql on windows using msi package   Hello Friend, visit hereADS
ModuleNotFoundError: No module named 'answer'
'answer' How to remove the ModuleNotFoundError: No module named 'answer'... to install padas library. You can install answer python with following command...ModuleNotFoundError: No module named 'answer'  Hi, My Python
ModuleNotFoundError: No module named 'answer'
'answer' How to remove the ModuleNotFoundError: No module named 'answer'... to install padas library. You can install answer python with following command...ModuleNotFoundError: No module named 'answer'  Hi, My Python
ModuleNotFoundError: No module named 'answer'
'answer' How to remove the ModuleNotFoundError: No module named 'answer'... to install padas library. You can install answer python with following command...ModuleNotFoundError: No module named 'answer'  Hi, My Python

Ads