I am a beginner-moderate java writer, and I have a problem that I just cannot understand, not even the cause.
I have some stuff in a class, a filewriter and -reader object, a scanner(system.in), and some strings, longs and ints. The idea is to easily write an .html document, and I nailed it already, but I created a for () loop around a bit of code containing scan.nextInt();
, and it just skipped it when running in the console.
A tiny part of the code:
int amlinks = scan.nextImt();
for (int i = 0; i < amlinks; i++) {
//refer file link1
//link1, ln12
System.out.print("[htmlbuilder.process]: text1 = ");
String link1= new String(scan.nextLine());
//refer text link1
//text1, line12, ln12
System.out.print("[htmlbuilder.process]: text2 = ");
String text1 = new String(scan.nextLine());
String link = new String(" <p><a href='" + link1 + ".html'>" + text1 + "</a>");
writer.write(link);
}
Some handy facts:
The class is called htmlbuilder
;
amlinks
is just a variable for the for ()
loop;
link1
and text1
variables are the required Strings for the links;
link
variable will eventually be written in the file,
writer:
Writer writer = null;
write = writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileID + ".html"), "utf-8"));
with fileID
as the name of the file;
the //info
before says what is inside the next piece of code.
I hope you understand what I am doing, I do know I have quite an own way of coding...
Thanks for help!
PS: Just ask some questions if you don't understand anything