CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: ProofRead

  1. #1
    Join Date
    Sep 2011
    Posts
    197

    ProofRead

    I would appriciate it if you'd let me know if this is foolish. Some times I seem to go off on random tangents that end up not making any sense. I would just appriciate to know if this code is headed in a sound logical direction.

    post script
    I formatted it so it's easy to read.
    Code:
    package test;
    import java.io.FileReader;
    import java.io.FileWriter; 
    import java.io.BufferedWriter; 
    import java.io.BufferedReader; 
    import java.io.InputStreamReader; 
    import java.io.InputStream; 
    import java.io.PrintWriter; 
    import java.io.IOException;
    import java.io.BufferedInputStream; 
    import java.io.Console;
    import java.util.Arrays;
    import java.io.IOException;
    import java.io.DataOutputStream;
    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.io.EOFException;
    import java.io.FileNotFoundException;
    import java.nio.file.Files;
    import java.lang.System;
    import java.lang.String;
    import java.nio.file.Files; 
    import java.nio.file.Paths;
    import java.nio.file.FileSystemException;
    import java.nio.file.InvalidPathException;
    import java.nio.file.FileSystemNotFoundException;
    import java.lang.IllegalArgumentException;
    import java.lang.SecurityException;
    import java.nio.channels.FileChannel;
    import java.nio.channels.*;
    import static java.nio.file.StandardOpenOption.*; // for RA
    import java.nio.file.StandardOpenOption;
    import java.lang.Enum;
    import java.nio.file.*;
    import java.nio.file.FileSystems;
    import java.nio.file.Paths;
    import java.nio.channels.*;
    import java.nio.ByteBuffer;
    import java.io.RandomAccessFile;
    import java.io.RandomAccessFile.*;
    import java.lang.StringBuffer;
    import java.lang.Byte;
    import java.io.ByteArrayInputStream;
    import java.io.CharArrayWriter;
    import java.util.Arrays;
    import java.io.CharArrayReader;
    import java.nio.CharBuffer;
    import java.io.DataInputStream;
    import java.io.PrintStream;
    import java.io.RandomAccessFile;
    import java.io.StringWriter;
    import java.io.Writer;
    import java.io.PipedWriter;
    
    
    
    public class Test  {
    
       public static final String file = "Test2.txt";
       public static Test nObj = newObj();
    
    // ------------------------- Ease Of Access --------------------------------------
      
    
      public void write(String str) {
          PipedWriter pw = new PipedWriter();
        try {      
          pw.write(str);
       }
       catch(IOException ioe) {
     }
    }
      public void soP(String print) {
        System.out.println(print);
     }  
      public void soP(int print) {
        System.out.println(print);
     } 
      public void soP(double print) {
        System.out.println(print);
     } 
      public void soP(char[] print) {
        System.out.println(print);
     } 
      public void soP(String[] print) {
        System.out.println(print);
     }
      public void soP(float[] print) {
        System.out.println(print);
     } 
      public void soP(float print) {
        System.out.println(print);
     } 
      public void print(String s) {
    
              if (s == null) {
                s = "null";
            }
       write(s); 
        }
     
    // ------------------------- End of E0A -------------------------------------------
      public static Test newObj() {
    
    
     return nObj;
    }
    
    
    
    public static void main(String[] args) throws IOException {
        nObj.print(file);
    
         }
    
    
     }
    Last edited by kolt007; October 24th, 2011 at 07:29 PM.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: ProofRead

    You haven't told us what it is supposed to do so how can we say if it's heading in the right direction?

    BTW are you sure your initialization of nObj is correct? you are calling the newobj() method which returns nObj which is not initialized yet - where are you creating the Test instance?
    Last edited by keang; October 27th, 2011 at 03:45 PM.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Sep 2011
    Posts
    197

    Re: ProofRead

    I'm trying to create a custom out.println. But, before I do that I got some reading to do.

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: ProofRead

    I'm trying to create a custom out.println
    Why? What is your class going to do that PrintStream doesn't already do?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Sep 2011
    Posts
    197

    Re: ProofRead

    Print in a method.

  6. #6
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: ProofRead

    What does that mean exactly.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured