sridevi
Scanner class
1 Answer(s)      a year and 7 months ago
Posted in : Java Beginners

import java.util.*;
class Dd
{
 public static void main(String args[])
 {
   Scanner sc=new Scanner(System.in);
   int a=sc.nextInt();
   int b=sc.nextInt();
   System.out.println(a+b);
 }
}

What's wrong init. my program does not work it shows ""cannot resolve symbol"".

View Answers

November 12, 2011 at 12:05 PM


Here your code works fine..Which java version you are using? Actually Scanner class was introduced in java 5.









Related Pages:
Scanner
Scanner  In java,while connectig keyboard through java.util.scanner class..it does not throws IOException..why
Scanner class
Scanner class  what have to do when an error occur about Scanner class.i code scanner sc=new Scanner(System.in); but it shows an error regarding this.   Use Scanner sc=new Scanner(System.in
Scanner class
Scanner class  import java.util.*; class Dd { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int... Scanner class was introduced in java 5
without scanner
and class and didn't use the scanner .   Hi Friend, Whether
scanner Class Error - Java Beginners
scanner Class Error  Hello Sir ,When i run the program of Scanner Class ,there is Error Can not Resolve Symbol-Scanner how i can solve..., Scanner class is not provided. Check your version.It should work with java 1.5
scanner problem - Java Beginners
scanner problem  the program that enters sides of the triangle using scanner and outputs the area of triangle  Hi Friend, We.... import java.util.*; public class AreaOfTriangle { public static void
Java file scanner
Scanner class. Description of code: J2SE5.0 provides some additional classes.... It also parses the primitive data. Scanner class gives a great deal of power..., we have used Scanner class to read the file. Output: Hello
XII STD RECURSION WITHOUT SCANNER
not wish to use the scanner class Is there anything i can do to improve thiscode? import java.io.*; public class reursion { public void main()throws
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using constructor ????  im getting error here..i hav used scanner class... am i getting error here... can we get output using scanner class , object
Pattern,Matcher,Formatter and Scanner classes
the java.util.Formatter class. java.util.Scanner is a simple text scanner which can parse...(); Class java.util.Scanner implements a simple text scanner (lexical...Pattern,Matcher,Formatter and Scanner classes This section Describes : 1
with out using scanner mul two matrices
with out using scanner mul two matrices  write a java program to multiply two matrices and print there result. note: don't use the scanner and the values is passed at run time....   import java.io.*; class
scanner program
scanner program  a news paper boy purchase 100 papers every day.he purchases papers at Rs.1.50 and sells at Rs.2.00 at each.any unsold news papers... his profit..using scanner
Console Input: Scanner
Java NotesConsole Input: Scanner The java.util.Scanner class (added... the Scanner class from the java.util package, the most common programming style... eventually have a GUI user interface, but Scanner is very useful for reading data
How to read from the console
Description: Scanner was introduced in jdk 1.5. This class help in taking the input from the console. Here in this sample program it will take one word...;sc = new Scanner(cons.reader());     
Local Port Scanner
Local Port Scanner       This is a simple program of java network. Here, we are going to define class named "LocalPortScanner" in which we use ServerSocket class
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
Hp scanner - Java Beginners
Hp scanner  Hi guys, i would like to access hp scanner using java programme. could you refer me some useful information to proceed
Line by Line reading from a file using Scanner Class
In this section, you will get to know about reading line by line a text file using java.util.Scanner class
file class
file class  Hi Friend, I have a file class it lets me extract all... java.util.*; public class ReadCSV{ public ReadCSV (){ } public static... File"); } Scanner in = new Scanner(System.in); try
barcode scanner device usage in database application
barcode scanner device usage in database application  Am trying to design a supermarket inventory desktop database application however I can't seem to know how to use a barcode scanner device on my application can anyone put me
how to pass class variable to another class
how to pass class variable to another class  i need to access a variable from a class to another class currently running at the same time. using... the following code: import java.util.*; class A { static int regd; static int
Class and method question, Java?
a value using the class Scanner. if the value read is not within the allowed range...Class and method question, Java?  Consider a Java class that you could use to get an acceptable integer value from the user. An object of this class
input using scanner and add/sub/mul/div of a matrix
input using scanner and add/sub/mul/div of a matrix  hiiii...... performe matrix add/sub/mul/div using scanner
Java Class Question?
Java Class Question?  b.Write an application that prompts the user... the user enters a selection.   import java.util.*; class Application...[]={2.00,2.50,3.25,4.50}; Scanner input=new Scanner(System.in
Java Date Class
class DateClassExample { public static void main(String[] args) { Scanner userIn = new Scanner(System.in); int dates, day, dayOfMonth, month, century, year
Determine if string is in class
and a Car class. The string is the name of the car, which i have multiple in my linked... we have created a class Car. Then we have created another class in which we have.... import java.util.*; class Car { private String name; private int price
convert it to BufferedReader class
convert it to BufferedReader class  import java.util.*; public class method { static Scanner console = new Scanner (System.in); public static... is the required code: import java.io.*; public class method { public static void main
Class SALE - Java Beginners
Class SALE  A company sale 10 items at different rates and details.... import java.io.*; import java.util.*; public class SALE { public static void...=0.0,p71=0.0,p72=0.0,p73=0.0,pp1=0.0,pp2=0.0,pp3=0.0; Scanner scan = new Scanner
Summary - Scanner
Java: Summary - Scanner The main use of java.util.Scanner is to read values from System.in or a file. Many Scanner methods fit a simple pattern: nextXYZ..., but Scanner also supports BigDecimal, BigInteger, Float (returns float), Boolean (returns
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
class
class  Is a class a subclass of itself
class
is a class to represent a country in medal tally. It has an attribute of country... medals. In this class, you should also define constructors, and assessor, mutator methods. Task 2 MedalTally.java is a class to model a medal tally, containing
Class
Class, Object and Methods       Class : Whatever we can see in this world all the things... is termed as a class. All the objects are direct interacted with its class
creating class and methods - Java Beginners
creating class and methods  Create a class Computer that stores... of the Computers. This class contains following methods, - Constructor method... ( ) method that creates array of 4 objects of Computer class and that takes input
Sub class of a previous java program
Sub class of a previous java program  Create a Faculty subclass... to the Employee base class that simply outputs a message ?Cannot change this Employee?s status... java program is this, import java.util.*; class EmployeeSalaries
using class and methods - Java Beginners
using class and methods  Sir,Plz help me to write this below pgm... the following code: import java.util.*; public class Student{ int rollNo...){ Scanner input=new Scanner(System.in); double max1=0,max2=0,max3=0,max4=0,max5=0,max
how to sort the result of this 2 class program in java.....????
how to sort the result of this 2 class program in java.....????  package setget1_method; import java.util.Scanner; public class Main { { { Scanner input = new Scanner(System.in); LBook[] book = new LBook[5]; String
movie class..(dr java) - Java Beginners
movie class..(dr java)  hi there.....am about to create a movie class... java.util.ArrayList; public class movie { private String movie_Title; private... the following code: import java.io.*; import java.util.*; public class movie
Find Month name using DateFormatSymbols class.
Find Month name using DateFormatSymbols class. In this tutorial, you will learn how to find the month name using DateFormatSymbols class. The class... DateFormat and SimpleDateFormar use DateFormatSymbols class to encapsulate
how to pass a string from one class to another
how to pass a string from one class to another  hi all, Good morning. I am trying to develop a coding pass a string from one class and declare in other class. the string which i need to pass is the data from an file and i want
Unable to get data from class - Development process
*; import java.util.*; public class ComControl implements Runnable...() + " opened for scanner input"); //serialPort2 = (SerialPort) portId2.open...; } } ========================================================================= In my other class, I have my desktop application which called
Low port Scanner
Low port Scanner       In this section, you will learn how to get local port number of the local machine. Here, we define the name of program LowPortScanner
Super class of an Exception class
Super class of an Exception class  hello,,, What is super class of an Exception class?   hii,, the super class of an exception is throwable class. and the super class of an throwable class is the object class
ReadLine(String fmt,Object... args) of Console class - Java Beginners
the string and objects of console class in Java?  Hi friend,import java.io.Console;import java.io.PrintWriter;import java.util.Scanner; public class... Password]: "); Scanner scanner = new Scanner(console.reader()); int in = 0
Class
Class       This section explores the concept of a class in reference to object oriented programming techniques. A class defines the properties of  objects and methods used
Use if, if else,for,while,do wile ad switch in same Java Class
how to use if, if else,for,while,do wile ad switch in same class? very urgent..   import java.util.*; import java.text.*; class Shop{ public String...("##%"); List<Shop> list = new ArrayList<Shop>(); Scanner scan = new
Explain final class, abstract class and super class.
Explain final class, abstract class and super class.  Explain final class, abstract class and super class.   Explain final class, abstract class and super class. A final class cannot be extended. A final class
.class and .tld
.class and .tld  how to create .class and .tld file
class loaders
class loaders   Explain static and dynamic class loaders
class file
class file  How to create class file in jsf easily