Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners variable answer1 might not have been initialized
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Steffi Grace M. Dimalibot
variable answer1 might not have been initialized
1 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners


import java .io.*; public class Test{ public static void main(String[] args) throws IOException{ BufferedReader steffi=new BufferedReader(new InputStreamReader(System.in)); String name; String answer1; int ctr1=0;

       System.out.println("Enter your name:");
       name=steffi.readLine();


       System.out.println("1.What is the name of the developer of java?");
       System.out.println("\tA. Steve Jobs");
       System.out.println("\tB. James Gosling");
       System.out.println("\tC. Bill Gates");
       System.out.println("\tD. None of these");
       System.out.print("Enter your answer:");
       if(answer1.equalsIgnoreCase("B"))
       {
        ctr1++;
       }


}

}


Advertisement
View Answers

September 17, 2012 at 11:07 AM


We have modified your code. Here it is:

import java .io.*;
public class Test{
    public static void main(String[] args) throws IOException{ 
        BufferedReader steffi=new BufferedReader(new InputStreamReader(System.in));
        String name; 
        String answer1=""; 
        int ctr1=0;

       System.out.println("Enter your name:");
       name=steffi.readLine();


       System.out.println("1.What is the name of the developer of java?");
       System.out.println("\tA. Steve Jobs");
       System.out.println("\tB. James Gosling");
       System.out.println("\tC. Bill Gates");
       System.out.println("\tD. None of these");
       System.out.print("Enter your answer:");
       answer1=steffi.readLine();
       if(answer1.equalsIgnoreCase("B"))
       {
        ctr1++;
       }

}

}


Related Tutorials/Questions & Answers:
variable answer1 might not have been initialized
variable answer1 might not have been initialized   import java .io...(System.in)); String name; String answer1; int...++; } } }   We have modified your code. Here it is: import java .io
Resources have been modified iPhone
Resources have been modified iPhone  Hi, My client is getting Resources have been modified error while installing AdHoc distribution on his iPhone. How to solve Resources have been modified iPhone error? Thanks   Hi
Advertisements
maximum limit of database connections have been reached.
maximum limit of database connections have been reached.  How do I check in my code whether a maximum limit of database connections have been reached
maximum limit of database connections have been reached.
maximum limit of database connections have been reached.  How do I check in my code whether a maximum limit of database connections have been reached
UI Component initialized
is initialized. 1. preInitialize: is dispatched when the component has been attached... and no children have been created. 2. initialize: is dispatched when a component has finished its construction and its initialization properties have been set
The app was not installed on iphone because its resources have been modified
The app was not installed on iphone because its resources have been modified  Hi, I am getting following error while my client is installing my... resources have been modified" What is the solution? Thanks   Hi, You have
How to find if you have been hit by Panda 4.0
How to find if you have been hit by Panda 4.0  Hi, This week Google Panda 4.0 is released. Now the question is how to find if your website have been... if your website have been hit by the Panda 4.0. Here are thinks you can do
Java variable
Java variable   To what value is a variable of the String type automatically initialized
What values initialized inside init() in servlet - Java Interview Questions
What values initialized inside init() in servlet  What will happen inside init() in servlet. my interviewer asked servlet lifecycle. i said "once... initialization " . Again interview asked what values will be initialized . what
What is the purpose of declaring a variable as final?
What is the purpose of declaring a variable as final?   Hi, What is the purpose of declaring a variable as final? Thanks   Hi, In Java when we declare a final variable as a variable which has been initialized
You have been working with this current firm for a long time. Don?t you think it would be difficult now to switch over t
You have been working with this current firm for a long time. Don’t... the needs of the position in question are similar to the work you have been doing so.... The best way to tackle this is to show how you have had many changing scenarios within
Protecting Your iPad Has Never Been Easier
. The amazing new features and light weight design have been largely responsible... convenient their lives have been or how their entertainment experiences have been...Protecting Your iPad Has Never Been Easier Since its release early in 2010
Local Variable and Instant Variable
Local Variable and Instant Variable  difference between Local Variable and Instant Variable   Difference between local variable and instance variable Instance variable is declared within a class but not within
Creating a Local Variable in JSP
consider a situation where we have to declare a variable as local, then we should...Creating a Local Variable in JSP          In jsp when we have to create a method
if variable is null php
a variable, you might need to reset it too. In that case you can use... unset...if variable is null php  How to check if submitted variable is null in PHP? Thanks!   Check if Variable is NULL in PHP You can use isset
Application Variable
Application Variable  I have multiple JSP's that are connected... the necessary data to establish a connection.. In every page I have to call... anyone show a simple sample code of storing the connection data in a variable so
Pointer a variable
Pointer a variable  hii, Pointer is a variable or not ?   hello, Yes, a pointer is a variable
Duplicated Session Variables
;     We don't have any need to create a new session variable because it has been created by the JSP container for you... name. Consider we have declared a session variable true in jsp page <%@ page
Converting jsp variable to java variable
Converting jsp variable to java variable  Hi how to convert java script variable to java variable on same jsp page
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
final variable
final variable  Please give some easiest and understanding example program for final variable
environment variable
environment variable  what are the environment variable is need to run j2ee application in eclipse could you explain the details
environment variable
environment variable  what is environment variable in java?   Environment variables are used by the Operating System to pass configuration information to applications
Creating a Local Variable in JSP
Creating a Local Variable in JSP      In jsp when we have to create a method or variable we usually declare.... This works like a instance variable.  Now consider a situation where we have
Static Variable
Static Variable  What is the basic use of introducing static variable... that a certain object/variable is resident in memory and accessed each time an instance..., it means that the static variable is shared among all instances of the class
Referance variable - Java Interview Questions
variable and parameter. When the method is called, the parameter slots are initialized...Referance variable  by using which reference variable we declare instance variable as local variable in java   Hi friend,Local variables
JBoss Tools 3 Alpha has been released
, Portal etc. All plugins in the new release have been now shifted to Eclipse... in the Eclipse API. The new features that have been added to this Release are as follows...The first Alpha release of JBoss Tools 3 has been made recently with intials
Java Final Variable
Java Final Variable  I have some confusion --Final variable has single copy for each object so can we access final variable through class name,or it is necessary to create object for accessing final variable
creating a global variable with php
creating a global variable with php  Is it possible to create a variable to declare as global in case of database connectivity?   Yes, if you want to have access of that variable anywhere in the program. See the example
how to value of one variable pass in other variable in revetse order
how to value of one variable pass in other variable in revetse order  Like variable a=367 b must have valuev763
how to assign javascript variable value to a jsp variable
how to assign javascript variable value to a jsp variable  how to assign javascript variable value to a jsp variable
Advertisements
 

 

 

DMCA.com