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
Write a program that reads and unspecified number of integers, determines how many positive and negative values have been read,
KonstantinChe [14]

Answer:

The program was wrote in the version 3.9.5 of python and it's in the homework.txt file.

Download txt
6 0
3 years ago
The statements in the body of a while loop may never be executed, whereas the statements in the body of a do-while loop will be
LenKa [72]

Answer:

a. at least once

Explanation:

A loop is a code snippet that uses a condition to run repeatedly for multiple times which could be zero, one or more times. As long as the condition is true, the loop statement executes over and over again. Three common types of loop are;

i. for loop

ii. while loop

iii. do while loop

In a for or while loop, the condition for the loop is first tested before the statements in the loop are executed. Statements in the body of the loop are executed zero or more times. i.e the loop statement (statement in the body of the loop) may or may not be executed.

In a do..while loop, the statements in the loop are executed first before the condition of the loop is tested. In this case, the statements in the body of the loop are executed one or more times. i.e the loop statement is executed at least once.

6 0
3 years ago
What can be controlled through IoT? Choose four answers.
BaLLatris [955]

Answer:

Door locks

Light switches

Security cameras

Thermostat

Explanation:

IoT is internet of things that means network of different things that are interconnected through internet and make the decision with the help of Electronic sensors. The sensor sense the data from environment at different times and send this to the cloud (that may be the server). On the basis of this data different devices such as door looks, light switches, security cameras and thermostat take decisions with the help of controllers and change their current state.

<u>For Example</u>

In case of door look, there may be sensor that is sensing the finger prints of the user and after recognizing the person the door will be unlock. If unauthenticated user will try to open the lock a message has been sent to concerned. The training data of the the authorized persons is saved on the cloud, whenever someone tries to access, the data from sensor and cloud send to controller for making comparison and decision. So we can say that Door lock can be controlled IoT.

In case of light switches, there are few sensor available to sense the intensity of life. Different training values of that sensors are stored on the cloud. Whenever these sensors sense the light intensity, they send the data to the cloud contentiously, whenever the data match with darkness intensity, a signal has been send from controller to the switch to ON the lights.

Same as in cameras and Thermostat both are sending data to the cloud and controller. With the help of different image processing techniques and sensor camera will take the decision related to face recognition. Thermostat devices are also on and off by variation of temperature.

7 0
4 years ago
One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
Ray Of Light [21]

One of 34 possible <u>Values</u> can be assigned to each axis of classification in the seven-character code.

<h3>Understanding Coding Guidelines</h3>

This question is taken from Conventions in ICD-10-PCS Official Guidelines for Coding and Reporting.

According to the convention A2 in the guidelines, One of 34 possible values can be assigned to each axis of classification in the seven-character code.

They are the numbers 0 to 9 and all the alphabets with the exception of I and O.

An example is where the fifth axis of classification specifies the approach, seven different approach values are currently used to specify the approach.

Read more about Coding at; brainly.com/question/16397886

7 0
3 years ago
What form of infrastructure improved trade and communication among Roman cities?
grigory [225]

Answer:

aqueducts

Explanation:

5 0
3 years ago
Other questions:
  • Rebecca completed work on a computer and is verifying the functionality of the system when she finds a new problem. This problem
    13·1 answer
  • What is information systems​
    5·1 answer
  • By default, the Windows desktop displays
    6·1 answer
  • Whay device is recommended to use to install windows 10
    13·1 answer
  • Which of the following is false? Group of answer choices A) A string may include letters, digits, and various special characters
    7·1 answer
  • Flowcharts allow you to more easily clarify among multiple potential solutions to a problem to see which solution is best.
    5·1 answer
  • Can someone please explain this issue to me..?
    12·2 answers
  • Desirable workplace habits and skills include:
    14·1 answer
  • Can you see the processing step yes or no
    8·2 answers
  • You have been trying all day to check your direct messages on social media. The site is really slow to load and sometimes you ca
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!