Questions tagged [printstream]

175 questions
-1
votes
1 answer

Output not getting as intened

I'm trying to read the file "ab.txt" and saving its content in "Output.txt" Kth times,so i'm suppose to get the content of input file K times in output file,but i'm getting only once whereas it is printing on console Kth times. import java.io.*; …
Shadab Faiz
  • 2,380
  • 1
  • 18
  • 28
-1
votes
1 answer

Where are the in and out members of java.lang.System initialized?

I have two questions related to the System class of java. First, where are in (input) and out (output) objects initialized? As these objects are declared as static and not initialized in the System class, and System class does not have a…
-1
votes
2 answers

Bug on Printstream. Only last statement ist writing

I have got following Problem. The string variable prints on the txt file ``` 1 3 1. ``` Actually, it must outputs ``` 1 1 1 1 2 1 1 3 1 ``` I don't know, where the error is in the Code. It seems to be that the code is overwriting everytime,…
-1
votes
1 answer

Why is there difference between out.println and err.println?

System.class contains "out" and "err" object of Printstream class. System.class is declared static. println() is a overloaded method in Printstream class which have (out and err objects) if we execute System.out.println("Xys"); and…
-1
votes
3 answers

Reading a line from a text file and put it in a JTextField

I have no clue how to read a line from a text file and put it in a JTextField. I have this so far to create a text file and be able to change the text inside it by changing my JTextFields. An example of this: public void outputFile() throws…
user3161041
  • 13
  • 3
  • 8
-2
votes
1 answer

java: Length of data changes after write in stream

I have saved a binary data in FileOutputStream but when I check the length of the data before and after I found that it changes from 72 to 106. This is my method: inputStream = new FileInputStream(certificate_file); /*Certificate file is a Path of…
mbazouz
  • 35
  • 6
-2
votes
1 answer

How i print a stack using printStream argument in java?

This is a method from an interface which i have to implement in another class and i don't know how to create it. I have to print the stack using linkedList with printStream argument. Inside the class Node(for linkedList) i have a method…
Damis Berzovitis
  • 205
  • 1
  • 3
  • 11
-2
votes
2 answers

How do I write a TreeNode to a PrintStream of a given File?

I have to write a method write(Printstream p) where p has been defined as new PrintStream(new File(QUESTION_FILE). I don't even really need to know how to go directly from a TreeNode into the PrintStream, just mainly how to put Strings line…
-4
votes
1 answer

Can a static member refer/access to an instance method of a class?

As far as i know it is not true then how come out variable of System class final static PrintStream out = null; can refer to the print method of the PrintStream class in System.out.print(); public void print(Object obj) { …
-4
votes
1 answer

Printstream Skipping Printing of First Line in a File

I have this code: public static void main(String[] args) { try { String filePath = (args[0]); BufferedReader br = new BufferedReader(new FileReader(filePath)); String strLine = br.readLine(); …
sdyes
  • 1
1 2 3
11
12