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
xeze [42]
3 years ago
15

What is the output of this code? import java.util.HashSet; class A { public static void main(String[ ] args) { HashSet set = new

HashSet(); set.add("A"); set.add("B"); set.add("C"); System.out.println(set.size()); } }
Computers and Technology
1 answer:
kompoz [17]3 years ago
5 0

Answer:

The code will give an error that is "At least one public class is required in main file".

Explanation:

In the given code if we do not use the public access modifier to the class. It will give an error so, the correct code to this question as follows:

Program:

import java.util.HashSet; //import package

public class A  //define class as public.

{

   public static void main(String[ ] args) //define main method.

   {

       HashSet set = new HashSet(); //creating hashset object.

       set.add("A"); //add alphabet in hashset

       set.add("B"); //add alphabet in hashset

       set.add("C"); //add alphabet in hashset

       System.out.print("Size of HashSet is :"set.size()); //print the size of hashset.

   }

}

Output:

Size of HashSet is : 3

Explanation of the program:  

  • In the above program, we define a public class that is "A" and inside the class, we define the main method.  
  • Inside the main method, we create a HashSet class object that is "set".  
  • To add elements in HashSet we use add() function that adds elements and in the last, we use the size() function that prints the size HashSet.
You might be interested in
A user saves a password on a website the user logs into from a desktop. Under which circumstances will the password be saved on
artcher [175]

Answer:

same encryption certificate

Explanation:

only logical xD

4 0
3 years ago
For each of the following SQL queries, for each relation involved,list the attributes that must be examined to compute the answe
Vlada [557]

Answer:

1. E.eid ,E.hobby, E.sal, E.did

2.E.eid , E.sal, E.hobby ,E.did , D.did, D.floor ,D.dname , D.budget.

3.E.eid , E.sal, E.hobby ,E.did , D.did, D.floor ,D.dname , D.budget.

4.E.eid , D.dname

Explanation:

The attributes that are examined for the query are the attributes of the table that are mentioned in the select statement and where clause.

So according to first query we are working on all attribues of Emp table so all of the attributes of Emp table are examined.In second query we selecting all attributes of both the tables hence all attributes of both the table and same in the next query.

In fourth query though the query is not complete where clause is missing but we have eid from Emp and dname from Dept tables for sure and the attributes mentioned in where clause will also be present.

7 0
3 years ago
How does a machine learning model is deployed
yan [13]

Answer:

Explanation:

Deployment is the method by which you integrate a machine learning model into an existing production environment to make practical business decisions based on data. It is one of the last stages in the machine learning life cycle and can be one of the most cumbersome.

7 0
3 years ago
Networking device converts analog signals to digital ones?
iren2701 [21]

Solution:

An analog-to-digital converter, or ADC as it is more commonly called, is a device that converts analog signals into digital signals. Analog information is transmitted by modulating a continuous transmission signal by amplifying a signal's strength or varying its frequency to add or take away data.

This is the required answer.

5 0
2 years ago
Suppose that a main method encounters the statement t3.join(); Suppose that thread t3's run() method has completed running. What
Slav-nsk [51]

Answer:

C. The main method proceeds to the next statement following the t3.join(); statement

Explanation:

join() method allows the thread to wait for another thread and completes its execution. If the thread object is executing, then t3.join() will make that t is terminated before the program executes the instruction. Thread provides the method which allows one thread to another complete its execution. If t is a thread object then t.join() will make that t is terminated before the next instruction. There are three overloaded functions.

join()

join(long mills)

join(long millis, int Nanos)

If multiple threads call the join() methods, then overloading allows the programmer to specify the period. Join is dependent on the OS and will wait .

8 0
3 years ago
Other questions:
  • A cell in a spreadsheet can contain _________?
    12·1 answer
  • You are to create a program using Python that asks the user for a nonnegative number, then computes the mean and variance using
    15·1 answer
  • Which are appropriate uses for special effects in presentations?
    14·1 answer
  • True or False: Unity can apply multiple textures to a single object or terrain
    9·1 answer
  • In controlling network traffic to minimize slow-downs, a technology called ________ is used to examine data files and sort low-p
    15·1 answer
  • What is the cell membrane used for ​
    14·2 answers
  • Please help me. Adnan also wants to add a photograph of a bridge. It is on another PowerPoint presentation that is open in a dif
    11·1 answer
  • WHAT IS ONE WAY A PIVOTTABLE COULD COMBINE THE FOLLOWING DATA
    10·1 answer
  • 9. "मेरे तो गिरधर गोपाल, दूसरो ना कोई
    5·1 answer
  • Leslie works in an SDLC team. When Leslie edits a file, it gets saved as an altered version. Later all the altered versions are
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!