1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
den301095 [7]
3 years ago
6

Which of the following is used to allocate memory for the instance variables of an object of a class?1. the reserved word public

Computers and Technology
1 answer:
kodGreya [7K]3 years ago
3 0

Answer:

The correct answer to the following question will be 2. the operator new.

Explanation:

New operator is used to allocating the memory to the instance object.The new object can be created by using a "new" keyword in java .

Syntax of using 'new' operator is :

class_name object_name=new class_name() // it allocated the memory to the class

For Example :

ABC obj = new ABC;  

Now, this time obj points to the object of the ABC class.

obj = new ABC ();

call the construction of ABC class

You might be interested in
Write a program that first calls a function to calculate the square roots of all numbers from 1 to 1,000,000 and write them to a
svlad2 [7]

Answer:

The csharp program to compute square roots of numbers and write to a file is as follows.

class Program  

{  

static long max = 1000000;  

static void writeRoots()  

{  

StreamWriter writer1 = new StreamWriter("roots.txt");  

double root;  

for (int n=1; n<=max; n++)  

{  

root = Math.Sqrt(n);  

writer1.WriteLine(root);  

}  

}  

static void Main(string[] args)  

{  

writeRoots();  

}  

}

The program to compute squares of numbers and write to a file is as follows.

class Program  

{  

static long max = 1000000;  

static void writeSquares()  

{  

StreamWriter writer2 = new StreamWriter("squares.txt");  

long root;  

for (int n = 1; n <= max; n++)  

{  

root = n*n;  

writer2.WriteLine(root);  

}  

}  

static void Main(string[] args)  

{  

writeSquares();  

}  

}  

Explanation:

1. An integer variable, max, is declared to hold the maximum value to compute square root and square.

2. Inside writeRoots() method, an object of StreamWriter() class is created which takes the name of the file as parameter.

StreamWriter writer1 = new StreamWriter("roots.txt");

3. Inside a for loop, the square roots of numbers from 1 to the value of variable, max, is computed and written to the file, roots.txt.

4. Similarly, inside the method, writeSquares(), an object of StreamWriter() class is created which takes the name of the file as parameter.

StreamWriter writer2 = new StreamWriter("squares.txt");

5. Inside a for loop, the square of numbers from 1 to the value of the variables, max, is computed and written to the file, squares.txt.

6. Both the methods are declared static.

7. Inside main(), the method writeRoots() and writeSquares() are called in their respective programs.

8. Both the programs are written using csharp in visual studio. The program can be tested for any operation on the numbers.

9. If the file by the given name does not exists, StreamWriter creates a new file having the given name and then writes to the file using WriteLine() method.

10. The csharp language is purely object-oriented language and hence all the code is written inside a class.

3 0
3 years ago
Html code to hyperlink file​
Dovator [93]

Answer:

<p>Want to contact a specific staff member?

Find details on our <a href="contacts.html">contacts page</a>.</p>

Explanation:

7 0
3 years ago
The faster an object is moving, the ________ the shutter speed needs to be in order to freeze motion.
statuscvo [17]

Answer:

jkdsdjdshj,dfh.jhdfbhjf

Explanation:

bchSDCMHCXZ NHCXHBDSVCHDH,KC NBDBSDMJCBDBFD,JHCDSMNBBNCSCBFDNJCFJKC FMNSDNMSDFCH ĐS,CJDBS,CBSJBV,FJNDBFDSFDVBFĐDVFBVJFDCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDHCD

5 0
3 years ago
Read 2 more answers
Give four characteristics of hard disk​
Lubov Fominskaja [6]

Answer:

1. Mass Storage Devices

2. Available Storage Space

3. Data Access Performance

4. Device Form Factor and Connection

3 0
3 years ago
. Java is a high-level language.. true or false?
frutty [35]

Answer:

the answer is true. it is a high level language

4 0
3 years ago
Other questions:
  • What runs a network, steering information between computers and managing security and users?
    11·1 answer
  • The approved systems design document is used by programmers, the personnel department, and information systems personnel.
    8·1 answer
  • What type of engineer is needed in the following scenario?
    7·2 answers
  • A location in memory used for storing data and given a name in a computer program is called a because the data in the location c
    14·1 answer
  • What are the origins of the parking barrier?
    12·1 answer
  • 2) A simple operating system supports only a single directory but allows it to have arbitrarily many files with arbitrarily long
    7·1 answer
  • Website designers work on the code and programming of a website, not the style or layout of the site.
    9·1 answer
  • A UI text element must be added to ______.an empty background container game objecta prefaba slot game objecta tray objecta canv
    6·1 answer
  • An excerpt of a sample business cover letter. The text uses curly font and has a warm to cold color background. What change does
    13·1 answer
  • You work part-time at a computer repair store. You're building a new computer. The customer has requested two serial ATA (SATA)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!