This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I'm really not sure what you're trying to do. First, there are two things wrong with that line of code. First, write() returns "void", meaning nothing. You can't append "void" to a String -- you have to have actual data to append. So this line won't compile. It also won't compile because the += operator reads the existing value and appends to it, but you never initialize the String to a starting value. Java won't let you read an uninitialized variable. Strings aren't appropriate for holding the binary data that ObjectOutputStream produces; note that, unlike C, in Java bytes and characters are distinct data types. Can you tell me what you actually want to accomplish? I'm pretty sure you shouldn't be using ObjectOutputStream at all, since I don't see any objects being serialized here. Let me know what you actually need to do, as opposed to what you're trying to code, here, and I will try to point you in the right direction.
Ok here is the deal. I want to make an consoleapp. I want to ask the user to eneter two things. First and lastname. The value of the users choice of letters are supose to be stored in a string or array. So if I type Je then Th it would be String myVar = "Je Th"; Thanks for your answer!