Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation pllllz help me in java

    hi
    how r u
    i have this question pllllz try to help me on it

    Write a program in a language of your choice that can test and check how much memory is installed in your computer.

    i want it in java plllz

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Sorry, we have to follow http://www.codingforums.com/rules.htm
    1.5) No homework assignments - Do not post your entire homework assignment and request that other members do it for you. This is considered cheating, and your thread may even be used by your school to prove your guilt. Now, you may ask for advice or help on a specific aspect of your assignment that you're having trouble with. Use common sense as far as what's acceptable in terms of soliciting help with homework assignments.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    hi
    i wrote this code for checking
    free memory ,allocated memory ,max memory ,total free memory.

    import java.util.*;

    public class Memory
    {
    static Scanner consloe=new Scanner (System.in);
    double runtime,maxMemory,freeMemory;

    public static void main(String[]args)
    {

    Runtime runtime = Runtime.getRuntime();

    long maxMemory = runtime.maxMemory();
    long allocatedMemory = runtime.totalMemory();
    long freeMemory = runtime.freeMemory();

    System.out.println("free memory: " + freeMemory / 1024);
    System.out.println("allocated memory: " + allocatedMemory / 1024);
    System.out.println("max memory: " + maxMemory /1024);
    System.out.println("total free memory: " +
    (freeMemory + (maxMemory - allocatedMemory)) / 1024);

    }
    }

    i don't know if it's correct or not??
    this is the question
    Write a program in a language(java) of your choice that can test and check how much memory is installed in your computer.

  • #4
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    ???????

  • #5
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    heeeeeeeeeeeeeeeeeeeeelp me

  • #6
    Gox
    Gox is offline
    Regular Coder Gox's Avatar
    Join Date
    May 2006
    Location
    Ontario, Canada
    Posts
    392
    Thanks
    2
    Thanked 20 Times in 20 Posts
    When you run you program does it correctly tell you have much memory you have on your computer? That'd be one good way to check if it's correct.

    You got to put in a little effort here. Read the article accompanying the code you copied and it'll help you understand if the code is correct. In case you forgot where you got the code it can be found here: http://blog.codebeach.com
    Last edited by Gox; 11-06-2010 at 08:06 PM.


  •  

    Posting Permissions

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