Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners java memory allocation for member variables and member functions

Have Programming Question? Ask it here!
 
 
 


prasanjeit
java memory allocation for member variables and member functions
2 Answer(s)      a year ago
Posted in : Java Beginners


Suppose I have created a class named test with a member function name fun() that has three variables a=5,b=6.My questions are 1>When will the memory be allotted for these variables at run time or at compile time??? 2>Suppose i do not create a main method then will the memory be allotted for member function fun() and its variables?? 3>suppose i write a main method and from it i create an object q of test class then when shall the memory be allotted for function fun() and its variables ?? 4>When does java set default values of variables declared in a class that has not been assigned with any value??


Advertisement
View Answers

August 4, 2013 at 7:05 PM


off course at running time .. how means explanation is given bellow... see there are two stage while execution . 1 - is converting of the source code into byte code this is called as the compilation and during this no memory allocation takes place . and now 2- is the converting of the byte code to machine level i.e binary code for understanding to jvm purpose . this is called as the running phase during this phase jvm will allocate the memory for the data members .



August 4, 2013 at 8:22 PM


Thanks for your answer but can you answer my 4> question ??



Related Tutorials/Questions & Answers:
java memory allocation for member variables and member functions
java memory allocation for member variables and member functions  ...() that has three variables a=5,b=6.My questions are 1>When will the memory be allotted... not create a main method then will the memory be allotted for member function fun
Java memory allocation
Java memory allocation  How does Java allocate stack and heap memory
Advertisements
Nonaccess Member Modifiers - Java Beginners
Nonaccess Member Modifiers  what is Nonaccess Member Modifiers give... be variously applied to different Java elements. An abstract class cannot... information. http://wwww.roseindia.net/java/master-java/abstract-class.shtml
Java Memory allocation - Java Interview Questions
Java Memory allocation  By default what is the memory allocation size for a single class? How the memory is allocated? Based on what procedure
Member Classes, Inner Nested Classes in java
Member Classes        Member classes are defined within the body of a class. We can use member classes anywhere within the body of the containing class. We declare member classes
memory allocation
memory allocation   class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static... of execution of statement ? memory allocation ?  The code uses static
memory allocation
memory allocation  If we assign memory malloc(5) and access more than the assigned memory then what will happen? 1.segmentation error 2.memory leak 3.program will not compile 4.Your view
Controlling Java Heap Size Memory Allocation
Controlling Java Heap Size Memory Allocation  Hi, Tell me about Controlling Java Heap Size Memory Allocation? I have to run java program from console and allocate 2GB of RAM to Java Heap Size. Thanks   Hi, You can
call to a member function
call to a member function  While uploading the data on server i am getting following error... call to a member function children
Memory Allocation
Memory Allocation  What Is The Order Of Execution Of Statement 1) Statement Enclosed in {}. 2) Static 3) Public Static Void Main()   When jvm loads a class, static block is executed first, then main method. And at last
Member Classes
Member Classes       The class defined in the body of a class is called a member class. Member classes can also use instances of the same class without explicit
What is a local, member and a class variable?
What is a local, member and a class variable?   Hi, What is a local, member and a class variable? thanks
What does it mean that a class or member is final?
What does it mean that a class or member is final?   hi, What does it mean that a class or member is final? Thanks
In data structure in java how to parse the given string and counts the member of character that match the given data?
In data structure in java how to parse the given string and counts the member of character that match the given data?  Design a parser that parse the given string and counts the member of character that match the given data.using
How to access sub class member using super class object
How to access sub class member using super class object  class A{ } class B extends A{ int b=1; } class Test{ public static void main(String args[]) { what to do here to access sub class variable b using super class object
making consistency of data member in the whole programme without using static keyword
making consistency of data member in the whole programme without using static keyword  In the below programme i use one boolean variable named check , which is being accessed inside main function by two objects of Tst1 and Test2
java - Java Beginners
the memory allocation will be done to class variables,instance variables ,member varaiables in java   Hi Friend, Please visit the following link: http://www.roseindia.net/java/java-virtual-machine.shtml Hope
Variables in Java
Variables in Java       In this section, you will learn about Java variables... is stored when a program executes. The Java contains the following types of variables
Variables
Java Notes: Variables Variables are places in memory to store values... types (String, Color, JButton, ...). Java object variables... work in Java. Local variables and parameters are created when a method
Java memory leak
Java memory leak  What is memory leak
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
Variables in Java
Variable in Java In this section you will learn about variables in java. First we should know, what is variable? variable is a location in the memory where values persist. In Java, all variable must be declared first before
Java memory optimization
Java memory optimization  When you think about optimization, what..., You can use memory dump and then analyze it to find the process/java code in your program which is using large amount of memory. Ideally java should garbage
Access Modifiers
and accessibility of a class, member variables and methods. Java provides... with the member variables and methods to specify their accessibility. ... makes a member of the class available to all classes in the same package
Variables in Java
variables) Java Primitive Data Types Data Type Description... 0.0d In this section, you will learn about Java variables. A variable... when a program executes. The Java contains the following types of variables
Java Variables - Java Beginners
Java Variables  Hi, I had a small doubt. What are Object Reference variables in java..What actually they do.. And What actually an Object Reference variable will contain? As there are no pointers in Java, what are object
Java Variables - Java Beginners
Java Variables  Hi, I had a small doubt. What are Object Reference variables in java..What actually they do.. And What actually an Object Reference variable will contain? As there are no pointers in Java, what are object
Memory - Java Beginners
Memory management in Java  Where are these Heap and Stack? Is there size fixed? what is core area in memory
Determining Memory Usage in Java - java tutorial
Determining Memory Usage in Java 2001-08-28 The Java Specialists' Newsletter [Issue 029] - Determining Memory Usage in Java Author: Dr. Heinz M. Kabutz... parts in Java is guessing how much memory is being used by your object. We
Java - Declaring variables in for loops
Java - Declaring variables in for loops  Java - Declaring variables in for loops
Java Substituting Variables
Java Substituting Variables  Java Substituting Variables
Variables In Java
This tutorial demonstrates you about the variables and their types in java
memory
memory  what is memory
transient variables in java
transient variables in java  hello, What are transient variables in java?   hii, Transient variables are variable that cannot be serialized
Static & Instance variables in java
Static & Instance variables in java  What are the Difference between Static & Instance variables in java
PHP Variables Functions
PHP Variables Functions In this tutorial we learned about how to create functions or how to use predefined functions. If you want to see the real power of PHP you should use PHP functions. There are more than 700 in-built functions
Local/Instance/Class Variables
Java NotesLocal/Instance/Class Variables There are three kinds of Java variables: Local variables are declared in a method, constructor, or block..., but outside a method. They are also called member or field variables. When
Memory
Memory   what is the different between heap memory and stack memory ? please explain with example
PHP Mutator Accessor
method (also called "setter") is used to initialize the member variables of a class. According to the encapsulation principle the variables... of the private data member. These methods can be implemented on non-object-oriented
php Variables and Functions
PHP Variables Functions( ) In this chapter we will learn about PHP functions( ). Most of the beginners always think, why we create functions and  how does it help to the program? We create functions to make the program easier
memory
memory   hi i am jane pls explain the difference between heap memory and stack memory
Java Memory Leak - Java Beginners
Java Memory Leak  I am having a memory leak in my java version of the game Snake. I have narrowed the exact step of when the program memory.... The actually object that's eating up my memory is an array of ints which grows
java protected variables
java protected variables   Can we inherit the Java Protected variable..?   of course you can. But I think what you mean is "override"? Is tha so? There are some restriction
instance variables - Java Beginners
instance variables  instance variables
Java Get Memory
Java Get Memory       In this section of Java Example, you will see how to get the memory... can easily learn it. In this Java Get Memory Size example, we have created
Java get Free Memory
Java get Free Memory       In this section, we are going to obtain the free memory. In order to get the memory left of being allocated, the method getruntime() returns
interface variables - Java Beginners
interface variables  why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why it is final by default? thanks in advance
Even and odd functions in java
Even and odd functions in java  Even and odd functions in java   Example: import java.util.*; public class EvenOddFunction { public... have two separate functions for checking either number is even or odd. We
Java Variables Help Please!
Java Variables Help Please!  Hi, I just started with java and i need help with my school project, this is it so far: import java.util.*; public class ProjectCS { public static void main(String[] args) { welcome
Finding memory consuming process - Java Beginners
Finding memory consuming process  Hi, While debugging or optimizing your java application, how to find the memory consuming processes? Thanks
 

 

 

DMCA.com