Elemental_1_1's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
99 (0.06 per day)
Joined:
22-January 09
Profile Views:
1,894
Last Active:
User is offline May 03 2012 02:01 PM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   Elemental_1_1 has not set their status

Posts I've Made

  1. In Topic: Posting to an ASP.net/PHP web page through Java

    Posted 30 Apr 2012

    I found this during my research, I guess it just needs more googlin'

    Thanks for the help.
  2. In Topic: Will not write to .txt?

    Posted 22 Dec 2011

    awmygosh its so hard to read.

    well, when i use filereader/writer i use try catch finally, I dont know if that will help you though. why are all your variables funnily named? what kind of project is this for, if you dont mind me asking?
  3. In Topic: nextLine() assigns a value to a String but the value doesnt trigger

    Posted 22 Dec 2011

    thanks!
  4. In Topic: Null Pointer Exception in a Word Counter

    Posted 21 Dec 2011

    yeeey it all works! :D for some reason I cant +1 posts, sorry :(

    import java.util.Scanner;
    import java.io.FileReader;
    import java.io.StringWriter;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.io.File;
    
    //class sentenceCounter {
    //    public static int count(String str) {
    //        String delim = " ";
    //        String[] words;
    //        words = str.split(delim);
    //        return words.length;
    //    }
    //}
    
    class fileCounter {
        public static int count(String file) throws IOException {  
            FileReader inputStream = null; 
            StringWriter writer = new StringWriter();        
            try {
                inputStream = new FileReader(file);
                int c;
                while ((c = inputStream.read()) != -1) {
                    writer.write(c);
                }
            } catch (FileNotFoundException e) {
                System.out.println(file + " does not exist.");
            } finally {
                if (inputStream != null) {
                    inputStream.close();
                }
                if (writer != null) {
                    writer.close();
                }
            }
            String str = writer.toString();
            String delim = " ";
            String[] words;
            words = str.split(delim);
            return words.length;
        }
    }
    
    class wordCount {
        public static void main(String[] args) throws IOException {
                System.out.println("Type the text file name here, then press enter: ");
                Scanner scan = new Scanner(System.in);
                String name = scan.nextLine();
                File findFile = new File(name);
                if (findFile.isFile() != false) {
                    System.out.println("Your file contains " + fileCounter.count(name) + " words.");
                } else {
                    fileCounter.count(name);
                }
        }
    }
    
    
  5. In Topic: Retreive Data From Database

    Posted 21 Dec 2011

    more info?? what database are you using?

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
Current: Java
Have used: HTML, CSS, Javascript, PHP, MySQL, C++.

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

Comments

Page 1 of 1
  1. Photo

    successfulangel Icon

    09 Jul 2011 - 23:46
    I want to be your friend and i want to learn Java writing style from you .As i am beginner and i need to practice a lot..Can i know your gmail.If you let me know...I wil be really happy for it..:)
Page 1 of 1