Java IF statement problem

Java IF statement problem

Dear Sir/Madam i am using the following code. expected to not have any output but it still showing "welcome".. please help me why it showing "welcome".

class c1
{
int a=5;
while(a>1)
{
a=a+1;
if(a<3)
{
System.out.println("welcome");
        }
    }
}
View Answers

December 16, 2011 at 10:31 AM

This code is not even compiling. it is showing compiler errors.









Related Tutorials/Questions & Answers:
Java IF statement problem
Java IF statement problem  Dear Sir/Madam i am using the following code. expected to not have any output but it still showing "welcome".. please help me why it showing "welcome". class c1 { int a=5; while(a>1
Problem Statement : Show Booking System
Problem Statement : Show Booking System  Yashwant Rao Chavan Auditorium has few stage shows running currently. Initialize the Show data by de-serializing a serialized file provided in the Participant_Workspace of the project
Advertisements
goto statement problem. reply fast.
goto statement problem. reply fast.  I have done some operation... properly. I am using goto statement. void main() { float rs, p; char z...(); } problem happening is either its repeating again and again.. or its not repeating
Problem Statement : Show Booking System
Problem Statement : Show Booking System  Yashwant Rao Chavan Auditorium has few stage shows running currently. Now that we have the details of the shows that are currently running, we will book our tickets using following method
java if statement
java if statement  If statement in Java
Switch Statement with Strings in Java
Switch Statement with Strings in Java  Switch Statement with Strings in Java
if else statement in java
if else statement in java  if else statement in java explain with example
if else statement in java
if else statement in java  explain about simple if else statement and complex if else statement in java with an example
Java callable statement
Java callable statement  What is callable statement? Tell me the way to get the callable statement
JAVA statement - Java Beginners
JAVA statement  The import statement is always the first noncomment statement in a Java program file.Is it true?  Hi Friend, No,it is not true.If your class belongs to a package, the package statement should
conditional statement in java
conditional statement in java  Write a conditional statement in Java   Logical and comparison statements in OOPs are also know as conditional statements. You can learn "How to write conditional statement in Java " from
Java switch statement
Java switch statement  What restrictions are placed on the values of each case of a switch statement
GOTO Statement in java
GOTO Statement in java  I have tried many time to use java goto statement but it never works i search from youtube google but e the example on net are also give compile error. if possible please give me some code with example
If statement in java 7
If statement in java 7 This tutorial describes the if statement in java 7. This is one kind of decision making statement. There are various way to use if statement with else - If Statement :ADS_TO_REPLACE_1  If statement
java Problem
java Problem  I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me. Thanks in advance
JAVA Problem
JAVA Problem  Write a program that takes two parameters 1. a word 2. an array of words It should then remove all instances of the word in the array. For Example: INPUT word="ravi" word_array = ["Chethan Bhagat
ELSE STATEMENT!! - Java Beginners
ELSE STATEMENT!!  Hi! I just want to know why doesn't my else statement works? Else statement is there in the code below which is: else JOptionPane.showMessageDialog(null, n+ " is not in the array!");//doesn't work
Switch Statement in java 7
Switch Statement in java 7 This tutorial describes the if statement in java 7. This is one kind of decision making statement. Switch Statements : The switch statement is used when you want to test many statements based on some
for statement
for statement  for(int i=0;i<5;i++); { system.out.println("The value of i is :"+i); } if i end for statement what will be the output   got the answer.. it displays only the last iteration that is "The value of i
code problem - Java Beginners
code problem  Dear sir, my problem is that I've a string value if this String value has "quit" then output should be "bye". i want to make this program using SWITCH CASE statement. how to implement String value in Switch plz
java servlet connectivity problem with access
java servlet connectivity problem with access  Import java.sql...:odbc:CUSTOMER"); Statement st=con.createStatement(); // Execute... createStatement() location: class Connection Statement st
resolution problem in java
resolution problem in java  I designed project in java in my PC when run the same project in some other PC i can't fully view my java forms.Some said that it is resolution problem
Break Statement in java 7
Break Statement in java 7 In this tutorial we will discuss about break statement in java 7. Break Statement : Java facilitate you to break the flow... : If you want to terminate the outer statement java provides the way to do
Problem with code - Java Beginners
Problem with code  Hi Deepak. Im a newbie here at your forum. I have got a simple code of mine which is having a little problem. When I compile it, i...[ i ] + " "; }//end the for statement return myArgs; }//end
count statement that saves results on a variable in a java bean
count statement that saves results on a variable in a java bean  Hello i want to ask you where is the problem and my programme give me only null...; Statement statement = null; String SQLStr ; String retString
count statement that saves results on a variable in a java bean
count statement that saves results on a variable in a java bean  Hello i want to ask you where is the problem and my programme give me only null...; Statement statement = null; String SQLStr ; String retString
Continue Statement in java 7
Continue Statement in java 7 In this tutorial we will discuss about continue statement in java 7. Continue Statement : Sometimes you need to skip block... statement in loops.ADS_TO_REPLACE_1 In java 7, Continue statement stops the current
java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to [email protected]
Problem in uploading java application
Problem in uploading java application  I have uploaded my java application (folder created under webapps) using Filezilla FtpClient.Application... this problem
for a problem in coading - Java Beginners
for a problem in coading  what is the problm in following coading...(String[] args) { mywindow (); } }   Hi Friend, There is no problem... mywindows.java Run : java mywindows Thanks RoseIndia Team
Multiplication problem - Java Beginners
Multiplication problem  I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help
Switch Statement example in Java
for understanding more about the switch statement in Java. The following java... Switch Statement example in Java        This is very simple Java program
Java - Continue statement in Java
Java - Continue statement in Java       Continue: The continue statement is used in many programming languages such as C, C++, java etc. Sometimes we do not need to execute some
Continue statement in java
Continue statement in java In this section we will discuss about continue statement in java. continue is one of the branching statement used in most of the programming languages like C,C++ and java etc. Sometime we need to skip some
java input problem - Java Beginners
java input problem  I am facing a Java input problem
code problem - Java Beginners
java script j2ee j2me sql plz help me to sort out this problem. thnx  ...code problem  Dear sir, I'm havin a problem that suppose i've got a file that contains the following lines- java java script j2ee php sql
Problem on JAVA Programme
Problem on JAVA Programme  public class AA { int add(int i) { int y = i; y += 20; if (y <= 100){ y +=30;add(y);} System.out.println("Final Value of y : " + y); return y; } public static void main
JAVA CLASSPATH PROBLEM
JAVA CLASSPATH PROBLEM  hi all Friends I am stuck using the java servlets and problem raise for classpath. I had a problem with servlet to call... that it didn't found any java class (which is java class calling from servlet). but i
java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution... problem to the following mail id : Problem : upload excel file data into oracle database using java / j2ee. mail id : [email protected]
Java Problem - Java Beginners
Java Problem  Write a program 2 input a positive integer n and check wheter n is prime or not and also know the position of that number in the prime..., Code to solve the problem : import java.io.*; public class PrimeNumber
Java error missing return statement
Java error missing return statement       Java error missing return statement are those error in Java that occurred when a programmer forget to write
Java implementation problem
/answers/viewqa/Java-Beginners/28578-java-implementation-problem-.html...Java implementation problem  I want to implement following in java... problem in your post previews. please consider 1. 2. points just after main
coding problem - Java Beginners
coding problem  hi! i declared date as date datatype in oracle now i need to retrieve date from database to my java code.how can i please help me...; Statement stmt = null; try { Class.forName(driver); conn
code problem - Java Beginners
; Hi friend, Code to help in solving the problem : import java.io.... in Java visit to : http://www.roseindia.net/java/example/java/io/ Thanks
java implementation problem
java implementation problem   I want to implement following in java code : Main thread Create three threads wait for completion of stage 2 of all three threads Access all three local variable (LC0, LC1, LC2) of threads bulid
code problem - Java Beginners
code problem  Dear sir, I have an excel file in D: drive called today.xls, i want to open it thru java program, what code would be compatible plz help me  Hi friend, Code to help in solving the problem : import
problem 1 - Java Beginners
problem 1   Hi, please help me!!!! How can i code in java using Two-dimensional Arrays? This question is related to the one i posted before. this is my input data file: 88 90 94 102 111 122 134 75 77 80 86 94 103 113 80
Basic problem for Java experts
Basic problem for Java experts  This assignment will test your knowledge of Arrays Array searching Array sorting Array processing Specification An athletics club require a simple statistical analysis program for analysing lap
problem with main - Java Beginners
problem with main   import javax.swing.*; import java.awt.... a problem. when i compile it appears this message: java.lang.NoSuchMethodError: main... it with html file. applet.html: Java Applet Demo Thanks
Java Switch Statement
Java Switch Statement       In java, switch is one of the control statement which turns the normal flow control of the program as per conditions. It's like if-else statement but it can

Ads