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
Juli2301 [7.4K]
3 years ago
5

Write java code that displays all the objects in a stack in the order in which they were pushed onto it. after all the objects a

re displayed, the stack should have the same contents as when you started. files to be submitted: taskademo.java arraystack.java stackinterface.java
Computers and Technology
1 answer:
kolbaska11 [484]3 years ago
7 0
Let's assume you have a stack called "s".
You can very simply print each element out using a for each loop (the iterable (as shown below), or a classic for each loop, if you prefer). This method does not modify the stack in any way.

s.forEach(System.out::println);
You might be interested in
Security measures are sometimes described as a combination of physical, technical, and administrative (PTA) safeguards. Which of
attashe74 [19]

Answer:

Measures including device data encryption, anti-malware software, and communications encryption.

6 0
4 years ago
Write a program in Java programming language that given two clock times prints out the absolute number of minutes between them
Triss [41]

Answer:

// Java Program to Find the difference

// between Two Time Periods

// Importing the Date Class from the util package

import java.util.*;

// Importing the SimpleDateFormat

// Class from the text package

import java.text.*;

public class GFG {

public static void main(String[] args) throws Exception

{

 // Dates to be parsed

 String time1 = "18:00:00";

 String time2 = "7:30:50";

 // Creating a SimpleDateFormat object

 // to parse time in the format HH:MM:SS

 SimpleDateFormat simpleDateFormat

  = new SimpleDateFormat("HH:mm:ss");

 // Parsing the Time Period

 Date date1 = simpleDateFormat.parse(time1);

 Date date2 = simpleDateFormat.parse(time2);

 // Calculating the difference in milliseconds

 long differenceInMilliSeconds

  = Math.abs(date2.getTime() - date1.getTime());

 // Calculating the difference in Hours

 long differenceInHours

  = (differenceInMilliSeconds / (60 * 60 * 1000))

  % 24;

 // Calculating the difference in Minutes

 long differenceInMinutes

  = (differenceInMilliSeconds / (60 * 1000)) % 60;

 // Calculating the difference in Seconds

 long differenceInSeconds

  = (differenceInMilliSeconds / 1000) % 60;

 // Printing the answer

 System.out.println(

  "Difference is " + differenceInHours + " hours "

  + differenceInMinutes + " minutes "

  + differenceInSeconds + " Seconds. ");

}

}

7 0
2 years ago
__________ is a special place on the hard drive where items from memory can be temporarily stored for fast retrieval
andrew-mc [135]
The answer is swap file 
6 0
3 years ago
Read 2 more answers
What is high level language​
Alika [10]

<em>your </em><em> </em><em>answer </em>A high level language is a computer programming language that resembles natural language or mathematical notation.

8 0
2 years ago
Read 2 more answers
4. Software, biotechnology, and information technology hardware industries are examples of the type of knowledge industry A.mana
motikmotik
D.Has knowledge as its product?

6 0
4 years ago
Other questions:
  • ________ is the application of statistical techniques to find patterns and relationships among data for classification and predi
    14·1 answer
  • explain in detail how such a company can improve the focus and relationship with customers, and what they will benefit from this
    14·1 answer
  • When CPU failed what will happen?
    10·1 answer
  • Dust buildup inside a desktop PC case can be managed effectively by ____.
    7·2 answers
  • Given four inputs: a, b, c &amp; d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsi
    6·1 answer
  • I don't know how to explain what is motion in my own words
    7·2 answers
  • A network consists of 10 computers, all running windows 7 professional. one computer acts as a file server and serves up data to
    6·1 answer
  • State the difference between = and ==
    9·1 answer
  • You have just finished installing a network adapter adapter and booted up the system, the drivers. You open File Explorer on a r
    13·1 answer
  • Is there any website online to use android studio live?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!