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
Setler [38]
3 years ago
15

Write code to create a set with the following integers as members: 10, 20, 30, and 40.

Computers and Technology
1 answer:
IRISSAK [1]3 years ago
6 0

Answer:

import java.util.*;  

public class Create_set

{

   public static void main(String args[])

   {

       Set<Integer> hset = new HashSet<Integer>(); //creating set using hashset of Integer type

       hset.add(10); //add method add members to set

       hset.add(20);

       hset.add(30);

       hset.add(40);

       System.out.println(hset); //printing the set

       

   }

}

OUTPUT :

[20,40,10,30]

Explanation:

The above code is implemented through java language. First a collection object is created using Set interface. Then that interface is implemented using Hashset class. As they are of generic datatype, Integer type is declared for this object. Then using add() method elements of the set are added and at last they are printed.

Set is an unordered collection which means elements can't be accessed through their particular position and no duplicate values are stored in sets.  

You might be interested in
Arrange these steps of creating a presentation in the correct order. (notice that the given order is incorrect other than the ba
DedPeter [7]

Answer:

1) select the template option from the presentation wizard

2) select the background of your slideshow

3) assign animation to your slide​

4) click create presentation

Explanation:

not gonna lie, this was very confusing

hope it helps

3 0
3 years ago
(40 pointsAnd brainliest answer ASAP) Maria is recording her friend’s graduation ceremony. How can Maria ensure that the video i
snow_lady [41]

Answer:

camera

Explanation:

3 0
4 years ago
What would the output be if we replaced the math expression in the last line with dependents * ((yearsOnJob - 1) * 4) - 6 and th
Leona [35]

Answer:

Please check the explanation.

Explanation:

Let x=dependents * ((yearsOnJob - 1) * 4) - 6

where dependents=3

Lets supppose year on job 3

then

x=( 3*((3-1)*4)-6

x= 3*8 -6

= 24-6

=18

And similarly, we can calculate the value of arithmetic expression all the time.

5 0
3 years ago
Name two primary goals of quality assurance and control programs:
bulgar [2K]

Answer:

The two main goals are to reach CMM level 5, and when the company can be termed as optimized.

The second goal is to minimize the bugs at the current level as well. And this is important, as improvement is one thing, and ensuring you are correct at the current time is another, and which is essential for survival. And you can think of improvement only if you survive.

Explanation:

The dream of all companies is to become Optimized. And they always try to reach CMM level 5, such that they can serve their clients in the best possible manner. And it is the quality assurance team that keeps an eye on the working of the company and keeps on giving their feedback so that the team can provide better service to the clients in the future, and probably reach the CMMI level 5.

The control program makes the operating system better through the development of an environment in which one can run various other programs. And it, in general, formulates the graphical interface and leverage you to run various programs at one time in various windows. And the control programs are also being known as the operating environment.

5 0
3 years ago
A _______ file is a type of vector graphics file created specifically for Windows.
Tems11 [23]
A .wmf <span>file is a type of vector graphics file created specifically for Windows.</span>
7 0
4 years ago
Read 2 more answers
Other questions:
  • How many people assume the product owner role in the Scrum framework?
    15·2 answers
  • Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product.
    12·1 answer
  • Atms typically use single factor authentication. <br> a. True <br> b. False flashcard
    5·1 answer
  • When computing the cost of the basket of goods and services purchased by a typical consumer, which of the following changes from
    11·1 answer
  • Discuss, in brief thedifferent variations of BLAST. (Maximum 5 innumber)
    10·1 answer
  • In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
    13·1 answer
  • David wanted to build a Temple for God in________
    10·2 answers
  • Which term describes a number in base 16, using the digits from zero to nine along with A, B, C, D, E, and
    9·1 answer
  • Teknoloji ile ilgili 5 tane örnek yazabilir misiniz? Lütfen..
    12·1 answer
  • Which of the following is not a secondary memory. (a) pen drive (b) Hard disk (c) Ram (d) Magnetic disk
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!