This discussion is archived
4 Replies Latest reply: Jan 21, 2013 1:18 PM by aksarben RSS

easy question about objects

983102 Newbie
Currently Being Moderated
why with this code;

private Scanner x;

public void openfile(){

try {
x = new Scanner(new File(chinese.txt));

}

}

why do you say x is a variable at private scanner x and then make x an object? why do both variable and object? the code is from http://www.youtube.com/watch?v=3RNYUKxAgmw

Edited by: 980099 on Jan 19, 2013 4:30 PM

Edited by: 980099 on Jan 19, 2013 4:38 PM

Edited by: 980099 on Jan 19, 2013 4:42 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points