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
almond37 [142]
3 years ago
5

Public class Question4

Computers and Technology
1 answer:
enyata [817]3 years ago
4 0

Answer:

See explaination

Explanation:

import java.io.File;

import java.io.PrintWriter;

public class Question4 {

/*

* For this exercise you will be doing some basic operations to write to a

* file. You will be creating your very own Secrets of the Universe (TM)

*

* You can use the PrintWriter class to write to files (Chapter 11.4)

*

* Your code should perform the following actions:

*

* 1) Open/Create a file for writing at the following location:

* "files/question4/MySecretsOfTheUniverse.txt" If the file already exists

* you will want to overwrite its contents. 2) Add at least 3 of your own

* secrets of the universe to the file. Each secret should be on its own

* line. 3) Make sure to close your file so that the results are saved.

*

* Note: Your code should not throw any checked exceptions.Note: You will

* need to import some classes from the java.io package.

*/

public static void Question4() {

// creating a File object

File file = new File("files/question4/MySecretsOfTheUniverse.txt");

try {

// opening print writer to write to the file. the file will be

// created if not exist, but you have to ensure that the directory

// files/question4/ exists.

PrintWriter writer = new PrintWriter(file);

// writing three random statements to the file. I dont know anything

// about the secrets of universe you mentioned, so I'm just writing

// some random stuff that came into my mind. You can replace below

// lines with whatever you want to write.

writer.println("Humans are aliens from Mars, sent here to colonize Earth after they screwed up mars.");

writer.println("This universe and everything in it are probably brain cells of some huge cosmic organism.");

writer.println("There may be other forms of life co-exist here on our Earth that we can't see,"

+ " because they vibrate at a different frequency outside of all our measurements");

//closing file, saving changes

writer.close();

} catch (Exception e) {

//printing error if exception is occurred.

System.err.println(e);

}

}

public static void main(String[] args) {

Question4();

}

}

You might be interested in
Classify each of the following acts as a violation of confidentiality, of data integrity, source integrity, or availability, or
AlexFokin [52]

Answer:

A) Violation of Confidentiality and Source Integrity:

Passwords are very confidential information and are usually protected by both the owner and the ower of the system (which in this case is Yahoo). To obtain the passwords, the hacker had to illegally gain access to the source of the data which is on Yahoo servers. Hence a breach of confidentiality and lack of adequate integrity on the part of Yahoo.

B) Source Integrity: Anthony accidentally cuts the electricity from the server room. Why would he be able to do that? how did he gain access into the server room? This speaks to source integrity. People should not be able to access the server room except they are authorised.

C) Source Integrity and Confidentiality: NSA finds an efficient method to break AES. AES refers to the Advanced Encryption Standard. AES is a symmetric encryption technology known as a block cipher.

It is used by the United States Government for the classification of information. Their ability to break this code speaks to Violation of Source Integrity. In this case, they haven't exactly hacked any document. However, any document that was encrypted using this technology is already compromised at the source.

D)   Anna registers the domain name, "JohnSmith" and refuses to let John Smith buy or use the domain name: Violation of Availability.

It is assumed here that John Smith was the original owner of the domain but it was highjacked at expiration and registered by Anna. This kind of breach is called Violation of Availability of the domain name.

E) Some malware encrypts the victim’s hard drive with a secret key and a criminal asks for a ransom to decrypt.

This move is called the Ransomeware attack. The Integrity of the source of information (which is the hard drive) is already compromised. This is a combination of Source Integrity or availability and confidentiality violation.

F) The wiretapping of a cell phone is a breach of confidentiality and data integrity.

G) when there is a vulnerability in a system or software that is unknown to those who should be interested, it is called a Zero-Day vulnerability. Where there is a Zero-Day vulnerability there could be a violation of confidentiality, data integrity, source data and or it's availability.

Cheers!

4 0
3 years ago
If an exception is thrown, it is passed to a block of code that can ____, which means to receive it in a block that can handle t
sladkih [1.3K]

Answer:

Catch the exception.

Explanation:

In Computer programming, an exception can be defined as an unprecedented error or event that occurs unexpectedly while a computer software application or program is running. Thus, when this exception occurs while a software program is running, it would affect its flow.

However, if the software program is able to handle and process unprecedented error or event that occured unexpectedly, it would continue to run but if it cannot handle it, the software program will force quit.

In Java programming language, exception class such as IOException, UserException, TimeoutException, and exception subclass such as CharacterCodingException, FileNotFoundException etc may be thrown when a software program encounters an unexpected error or event.

A software program that is properly coded or well-written is able to check for exceptions and appropriately handle the exceptions (unexpected errors) so as to prevent the software program from crashing or forced to quit.

This ultimately implies that, when an exception is thrown using a try clause or throw statement as it occurs, it is caught by a block of code in the software program.

<em>Hence, if an exception is thrown, it is passed to a block of code that can catch the exception, which means to receive it in a block that can handle the problem. </em>

8 0
3 years ago
Which of the following is the process of turning on your computer system? A. Powering up B. Operating C. Toggling D. Booting up
ValentinkaMS [17]
D. Booting up is the correct answer.
7 0
4 years ago
When an organization uses cloud computing, they do not have to buy and maintain expensive hardware. Group of answer choices True
pshichka [43]

Answer:

The answer is "False".

Explanation:

Cloud computing refers to files and services, that are processed to retrieved over all the computers, rather than on the hard disk of your machine. It's also known as a Net metaphor, which is a so-called local disc and device, whenever you store information on a disc or run programs.

  • It uses distributed tools to save software and other equipment costs in organizations.  
  • It is a pay structure of "utility", that uses expensive hardware, and maintains it, that's why the given statement is false.

4 0
3 years ago
How do you take a screenshot on a Samsung tablet<br>​
kirill [66]

Explanation:

to capture a screenshot press and hold the power and volume down button at the same time for approximately 2 seconds

5 0
3 years ago
Other questions:
  • A consumer-directed digital or computer device that has a video output signal for displaying a video game is called a .......
    6·1 answer
  • Describe Format Painter by ordering the steps Jemima should follow to make the format of her subheadings more
    6·1 answer
  • What is Service Operations in ITIL​
    11·1 answer
  • What is the term that is used to describe a computer system that could store literary documents, link them according to logical
    10·1 answer
  • I just wanna promote my 2 yt channels c: <br> (the channels are in the comments of this question)
    14·1 answer
  • One student will be stationed near you in a coffee shop. The other student will be located two miles away from your school. You
    10·2 answers
  • The ideal hash function:
    5·1 answer
  • Anybody know the answer to this question?
    14·1 answer
  • Put the pieces of a function into the correct order as if you were writing a formula.
    14·1 answer
  • By the mid-1990s, how did revenue generated from video games compare to revenue generated from movies?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!