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
Marta_Voda [28]
3 years ago
10

How are static variables and methods created in Java? What happens if a non-static method of a class tries to access a static va

riable of that class? What happens to the static variables of a class once the class has no instances?
Computers and Technology
1 answer:
9966 [12]3 years ago
4 0

Answer:

Static variables are the variables decaraed with keyword static, static variables must be deacraled inside the class body, means we can not declare a static variable inside a method or consttructor, static variable belongs to class, for a class only one copy is created for static variable and used by all the objects/instances.

Static variable can access with class name like

X.i

Static method are the methods defined with static keyword, static method are also part of a class, we can access static meethod using class name like

X.printI()  

Explanation:

class X

{

//to create a static variable we need use static keyword with variable name like

public static int i;

// to create a static method we need to use static keyword while defining a method like

public static void printHello() {

 System.out.println("Hello");

}

/*

 * A non static method can access static variable of a class there is no issue

 * with that we can use a static variable in a non static method like

 */

public void printI() {

 System.out.println(i);

}

/*

 * As long as the class exist in JVM static variables will be there, as static

 * variable belong to class not with the instance,

 * it does not matters if there are instance exist or not

 */

}

You might be interested in
Please answer immediately!!!
diamong [38]

Answer:

Please check the attachment.

Remember:

All N1, N2, N3N, N4, N5, N6, N7 and each of them are certainly like the server. Also note that Router, repeaters, switch and transmitter are not mentioned in the above diagram. Please assume it in between each location.

Explanation:

Please check the attachment. Also, Remember that Server is at the head office, and rest 7 are the 7 branches. The VOIP, video surveillance, Door security system and the computer networks are being shown in the diagram. And each location has a network of computers joined through VLAN, and each of them are given the IP addresses of Class A, Class B and class C of the iPV4(or IPV6), which can be found by the future network administer, operators through the IP address, that is assigned.  

4 0
3 years ago
Which cpu type would most likely be found in a smartphone?.
dlinn [17]

Answer:

dual-core (two), quad-core (four) and octa-core (eight)

Explanation:

These are the most common according to my research.

If I helped you, can I please have brainliest?

Have a great day/night!

4 0
2 years ago
1. Build and test D-type Flip-Flop using a built-in SR flip-flop.
GaryK [48]

Answer:

The attached files contain the realization of a D flip-flop from an RS flip-flop. It also contains the truth tables for both kinds of flip-flops

Explanation:

An SR flip flop is like a light switch. Set turns it 'on' and reset turns it 'off'

A D type flip-flop is a clocked flip-flop which has two stable states. A D type flip-flop operates with a delay in input by one clock cycle.

D type flip-flops are easily constructed from an SR flip-flop by simply connecting an inverter between the S and the R inputs so that the input to the inverter is connected to the S input and the output of the inverter is connected to the R input.

8 0
3 years ago
How to the inverse function of f(x)=x2 +1 ,x>o
Sindrei [870]
    f(x) = x² + 1, x > 0
       y = x² + 1
       x = y² + 1
   x - 1 = y²
√x - 1 = y
√x - 1 = f(x), x > 1
5 0
3 years ago
The keywords used in programming languages that use decisions to redirect the flow of a program are called __
olchik [2.2K]
The keywords used in programming languages that use decisions to redirect the flow of a program are called control structures.
6 0
3 years ago
Other questions:
  • If you are working on a document and want to have Word automatically save the document every minute, what steps should you use t
    13·1 answer
  • Help with this chart please
    9·1 answer
  • What is meant by encapsulating semaphores? Bring out the need for it
    12·1 answer
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • Which rule should be followed to stay safe online
    5·1 answer
  • Creating an accurate inventory is a challenge, given the speed at which data files are created, deleted, moved, and changed. It
    12·1 answer
  • Determine the following information about each value in a list of positive integers.
    14·1 answer
  • If im downloading a game at 4mb/s how many minutes would it take to download 25 GB
    14·2 answers
  • Help fast fast anyone
    10·1 answer
  • Please answer the following question in Verilog.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!