Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2012, 11:24 AM
maxstudies maxstudies is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 maxstudies User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 47 sec
Reputation Power: 0
Swing - Scanner class problem

uide.java:2: cannot resolve symbol
symbol : class Scanner
location: package util
import java.util.Scanner;
^
uide.java:9: cannot resolve symbol
symbol : constructor FileInputStream ()
location: class java.io.FileInputStream
FileInputStream file = new FileInputStream();
^
uide.java:54: open(java.lang.String) has private access in java.io.
FileInputStream
file.open(" F:\\abcd.txt");

here is the source which is written

import java.io.*;
import java.util.Scanner;
public class uide
{
public static void main(String args[])throws IOException
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
FileInputStream file = new FileInputStream();
System.out.println("ENTER THE CORRESPONDING CHAPTER NO.");
String q0 = input.readLine();
System.out.println("");
String q1 = input.readLine();
int m9 = Integer.parseInt(q0);
System.out.println('\f');
if (m9==1)
{
System.out.println("");
int m8 = Integer.parseInt(q1);
if(m8==1)
{
System.out.println("define the question");
System.out.println("");
file.open(" F:\\abcd.txt");
}
}
}
}

Reply With Quote
  #2  
Old November 7th, 2012, 08:33 AM
Shaun_B Shaun_B is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 61 Shaun_B User rank is Corporal (100 - 500 Reputation Level)Shaun_B User rank is Corporal (100 - 500 Reputation Level)Shaun_B User rank is Corporal (100 - 500 Reputation Level)Shaun_B User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 42 m 57 sec
Reputation Power: 2
Exclamation

Java Code:
Original - Java Code
  1. import java.io.*;
  2. import java.util.Scanner;
  3. public class uide
  4. {
  5.  public static void main(String args[])throws IOException
  6.  {
  7.      InputStreamReader reader = new InputStreamReader(System.in);
  8.      BufferedReader input = new BufferedReader(reader);
  9.      FileInputStream file = new FileInputStream();
  10.      System.out.println("ENTER THE CORRESPONDING CHAPTER NO.");
  11.      String q0 = input.readLine();
  12.      System.out.println("");
  13.      String q1 = input.readLine();
  14.      int m9 = Integer.parseInt(q0);
  15.      System.out.println('\f');
  16.      if (m9==1)
  17.      {
  18.          System.out.println("");
  19.          int m8 = Integer.parseInt(q1);
  20.          if(m8==1)
  21.          {
  22.              System.out.println("define the question");
  23.              System.out.println("");
  24.              file.open(" F:\\abcd.txt");
  25.             }
  26.         }
  27.     }
  28. }

Firstly, I can't see where you are using the Scanner? It seems to be an unused import. Secondly, please use the Highlight tag so that your code is lined up properly.

Also, when you are dealing with file handling, you should always try and catch.

Here is your code without errors - although I'm not saying it's going to be doing what you want it to... it just compiles okay:
Java Code:
Original - Java Code
  1. import java.io.*;
  2. import java.util.Scanner;
  3. public class uide
  4. {
  5.     public static void main(String args[])throws IOException
  6.     {
  7.         InputStreamReader reader = new InputStreamReader(System.in);
  8.         BufferedReader input = new BufferedReader(reader);
  9.         File file = new File("F://abcd.txt");
  10.         FileInputStream fin = null;
  11.         System.out.println("ENTER THE CORRESPONDING CHAPTER NO.");
  12.         String q0 = input.readLine();
  13.         System.out.println("");
  14.         String q1 = input.readLine();
  15.         int m9 = Integer.parseInt(q0);
  16.         System.out.println('\f');
  17.         if (m9==1)
  18.         {
  19.             System.out.println("");
  20.             int m8 = Integer.parseInt(q1);
  21.             if(m8==1)
  22.             {
  23.                 System.out.println("define the question");
  24.                 System.out.println("");
  25.                 fin = new FileInputStream("F://abcd.txt");
  26.             }
  27.         }
  28.     }
  29. }

It'd be an idea if you say exactly what you are trying to achieve, rather than randomly pasting code.

Good luck though.

Regards,

Shaun.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Swing - Scanner class problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap