java - incompatible types error when providing a String to a method which requires a String -
I consider string values as a string which accepts the string, although I am getting an "incompatible type" error. I I tried to codify an intensive value, to see what error I expect from:
found int; Required: java.lang.String has changed the method for accepting the file, instead of errors: string found; Required: java.io.file Ergo, I'm feeding a string where the string should be. But I do not know where I'm going wrong. (And I have changed it to feed back the string and accept the string) Any feedback is welcome in advance :)
import java.io . *; Import java.util. *; Public classroom tests {Personal ArgsReader inputFile; Private string filename; Private listing & lt; Pallet & gt; EntryBayQueue; / ** * Constructor / Public Test for the class test * object () {inputFile = New ArgsReader (); EntryBayQueue = new linked list (); } / ** * Methods * / Public Zero Run (string [] Args) {If (args.length> gt; 0) // If you have given any argument {string line; File name = args [0]; Println (filename.getClass () getSimpleName ().); // output string row = inputFile.stringFileReader (filename); // Call method has the ability to read the capabilities to read and read the line. **************************************************************************************************** ************** // line = null string string here; string = new string-locator (line); // Line line console while (st.hasMoreTokens ()) {System.out.println (st.nextToken ()); Int Serialum = 0; Switch (st.nextToken ()) {case "A": {serialNum ++; Palette almondplate = new pallet (1, serial); // Create new almond bullet and assign serial number entryEbquiew.ed (almondplate); // The list connects the pallet at the end of the break; }}}} // When you did not provide any arguments, then started {filename = null; Console Console = System.console (); filename = console.readLine ("By reading the file:"); inputFile.stringFileReader (file name); // Call method reading ability}}} // ****** This stringfile reader is the implementation of the public Zero String File Reader (string filename) {{input = new FileReader (filename); // open file to read (string filename) buffer = new buffer (input); // Read a line in a timeline = buffReader.readLine (); // While reading 1 line (line! = Zero) {lineNum ++; Println (line); Line = buffer. Readline (); // read the next line}} hold (IOException e) {System.out.println ("caught IOEception")}}
public should be zero string file reader (string filename)
Comments
Post a Comment