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
When I’m design view, Henrietta deleted a previous criterion, added a new column, and filtered patients’ age. Which best describ
BaLLatris [955]

Answer:

Explanation:

b

8 0
3 years ago
Reserve space in memory for a variable called UIN of size word. The initial value of UIN will be the sum of the digits in your U
sladkih [1.3K]

Answer:

Explanation:

See the attached picture for answer.

4 0
3 years ago
What is the "key" to a Caesar Cipher that someone needs to know (or discover) to decrypt the message? a) A secret word only know
Tpy6a [65]

Answer:

The number of characters to shift each letter in the alphabet.

Explanation:

Caeser Cipher is the technique of encryption of data, to make it secure by adding characters between alphabets. These are the special characters that make the message secure while transmitting.

According to the standards, For Decryption, we remove these special characters between alphabets to make message understandable.

<em>So, we can say that,to de-crypt the message, the number of characters to shift each letter in the alphabet.</em>

3 0
3 years ago
Microsoft word's spell checker?
vekshin1
The answer to the given picture is - Microsoft word's spell checker only recognizes very common words. Microsoft word has it's own dictionary which will be compared to the texts on your document. If they see an unfamiliar word they will underline it with red. Anyways you can add your own words and names to the custom dictionary.
8 0
3 years ago
Which of the following is one of the most important considerations when designing a website A. Purpose B. Budget C. Size D. Pict
Sladkaya [172]

answer would be A: purpose

7 0
3 years ago
Other questions:
  • What does GPA mean? Please tell me!
    13·2 answers
  • Select the correct answer.
    12·2 answers
  • What analogy could you use to explain the hardware parts of a computer?
    11·1 answer
  • What is meant by polling mode in communication between software andUART and what is its disadvantage as compared to interrupt mo
    14·1 answer
  • One reason to buy a home instead of rent a home is:
    5·1 answer
  • What is the correct html element for playing audio files?
    11·1 answer
  • Functions can accept any number of arguments.
    8·1 answer
  • A technology called ______
    11·1 answer
  • Which device allows users to directly hear data from a computer
    5·1 answer
  • What does dr. sanford say about the comparison of the genome with a computer program?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!