Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Tersa

Greenhorn
+ Follow
since Nov 26, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tersa

i am trying to print column headers to a file with
- format.justify
- printwriter stream
and etc...but it is not working....can anyone give me an example of a code to output this to a file?? thx
18 years ago
how do i add something to files so that the old data is not overwrited??
18 years ago
string word;
Get input for word from user

can someone help me with my program...I want to create a file contains string word (from above) and then the file will output this info onto the terminal screen afterwards. However, if I loop it so that the next user will be able to enter another value for the same variable word then the file will accumulate the info and display both contents
e.g 1st user enters "Hi" for variable word
file saves this info
outputs this info
next uesr enter "Bye" for variable word
I would like the output to look exactly like: Hi Bye

how would i do this?? Can someone help me with the code thx
18 years ago
int hours = 1
String report = "report"
double time = 3.50
can someone please help me with this, having lotz of trouble!!Arghh :-)...i would like to create a file that contains the info from hours, report and time. Then I would like to output the info from this file onto the terminal screen afterwards. How would I do this?? (It would be great if you could provide me with the code) Thanks a lot! Really appreciate your help!!
The output should be
1 report 3.50
18 years ago
can you explain the code Rahul cuz i don't get it. thx
18 years ago
is there a keyword for putting a space between characters without using + "" +
18 years ago
**THis is a code I got from Rahul
HOw do i alter this code so that it can read a string or a double ?? Here it can only read either character and i've tried integer type and it works too. Thx
import java.io.*;
class demo{
public static void main(String args[]){
try{
FileOutputStream in=new FileOutputStream("Rahul");
in.write('r');
in.close();
}
catch(Exception e){
System.out.println(e);
}//end of catch
try{
FileInputStream in=new FileInputStream("Rahul");
int i=0;
while((i=in.read())!=-1){
System.out.println((char)i);
}//end of while
}//end of try
catch(Exception e){
System.out.println(e);
}//end of catch
}//end main
}//end class
18 years ago
i am writing a program that involves the user typing in an integer type value. However, i want to check if they type anything else, such as an string, so that i could display an error msg. How can i do this?? Thanks for your help
18 years ago
hi i'm a beginner in java. I would like the program to read the name and the phone number of the user into a file using input and output streams (e.g. "Angel 123456") The info for different users will also be considered. It'll be great if anyone can help although I didn't explain it too well... but thanks anyway!!!
18 years ago