daarkfall's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
New Members
Active Posts:
15 (0.01 per day)
Joined:
27-August 09
Profile Views:
1,208
Last Active:
User is offline Oct 19 2013 12:19 PM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Nissan
Dream Kudos:
0

Latest Visitors

Icon   daarkfall has not set their status

Posts I've Made

  1. In Topic: File input and File output java promblems

    Posted 15 Jul 2013

    This is how i would do it, define the file and then pass it to a file reader, then finally use a buffered reader to parse the file.

    From there create a while loop which assigns the line to a predetermined string value and asserts that the line is not null (End of the file)
    finally close the buffer

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    
    
    public class Test {
    
    	public static void main(String[] args)
    	{
    		try{
    		File file = new File("usernames.txt"); // define the file
    		FileReader fileReader = new FileReader(file); // select the reader module
    		BufferedReader br = new BufferedReader(fileReader); //define the type of reader
    			
    
    		String s = "";
    		while((s = br.readLine())!= null) //assign the next line
    		{
    			printMethod(s); //call your method 
    		}
    		br.close(); // close the stream
    		
    		}catch (IOException IOE)
    		{
    			IOE.printStackTrace();
    		}
    		
    	}
    	
    	private static void printMethod(String method)
    	{
    		System.out.println(method);
    	}
    }
    
    
    



    Hope this helps ~ Daark
  2. In Topic: How do I store text?

    Posted 3 Feb 2013

    http://heather.cs.ucdavis.edu/~matloff/Java/JavaIntro.html
    

    Here is a relatively good introduction to java.

    I would also recommend the text book head first with java
     http://www.amazon.co.uk/Head-First-Java-Kathy-Sierra/dp/0596009208 
    


    Both are excellent resources for getting into grips with the basics of java programming :)/>

    But essentially what you are actually looking for (so as to be of some use)

    is
    
    String x = " hello world "; //the string object is the most basic form of handling text in java
    char [] x_two = {'h','e','l','l','o',' ', 'w','o','r','l','d'}; //similar to C you can also treat text as a character //array, 
    
    //Strings can also be transformed into character arrays 
    x_two = x.toCharArray(); // its something like that i am not on my development machine at the moment
    
    
    


    Hope this helps dude

    ~Daark
  3. In Topic: Grading system.. using GUI and array

    Posted 20 Dec 2012

    Hey man,

    Your best bet is to use an ArrayList, these are unbounded structures and make life so much easier, you can essentially treat them like an array (although are not indexable)

    You will need this import
    import java.util.arraylist;
    
    


    Defining an array list
    ArrayList<String> x = new ArrayList<String>();
    
    


    adding to an array list
    x.add(new String("lol"));
    
    


    measuring the size
    x.size()
    
    


    You could also you hashmaps as mentioned above :)/>/>

    Hope this helps,
    ~Daark
  4. In Topic: random number generator problem

    Posted 13 Nov 2012

    Hi sas,

    Java ui development can be troublesome to get the hang of but essentially what you will want to do is follow this guide
    http://docs.oracle.c...torial/uiswing/ .

    For the sake of completeness i would change
    public void printnumbers( int j, int [] LotteryNumbers)
    

    to

    public int[] printnumbers( int j, int [] LotteryNumbers)
    


    This means you can call it from your front end and receive your lottery numbers for display.

    Good luck

    ~Daark

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Interests:
Gaming, Music

Contact Information

E-mail:
Private

Friends

daarkfall hasn't added any friends yet.

Comments

daarkfall has no profile comments yet. Why not say hello?