Question

What is output 1 in the code below? import java.util.; public class StackDemo { public static void main(String [] args) { St

0 0
Add a comment Improve this question Transcribed image text
Answer #1

25 21 18


if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and i can edit and change the answers if you argue, thanks :)

Add a comment
Know the answer?
Add Answer to:
What is output 1 in the code below? import java.util."; public class StackDemo { public static...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Provide comments for this code explaining what each line of code does import java.util.*; public class...

    Provide comments for this code explaining what each line of code does import java.util.*; public class Chpt8_Project {    public static void main(String[] args)       {        Scanner sc=new Scanner(System.in);        int [][]courses=new int [10][2];        for(int i=0;i<10;i++)        {            while(true)            {                System.out.print("Enter classes and graduation year for student "+(i+1)+":");                courses[i][0]=sc.nextInt();                courses[i][1]=sc.nextInt();                if(courses[i][0]>=1...

  • I need help running this code. import java.util.*; import java.io.*; public class wordcount2 {     public...

    I need help running this code. import java.util.*; import java.io.*; public class wordcount2 {     public static void main(String[] args) {         if (args.length !=1) {             System.out.println(                                "Usage: java wordcount2 fullfilename");             System.exit(1);         }                 String filename = args[0];               // Create a tree map to hold words as key and count as value         Map<String, Integer> treeMap = new TreeMap<String, Integer>();                 try {             @SuppressWarnings("resource")             Scanner input = new Scanner(new File(filename));...

  • What is the output of the following code? 3eimport java.util.LinkedList; 4 import java.util.Queue; 7 public class...

    What is the output of the following code? 3eimport java.util.LinkedList; 4 import java.util.Queue; 7 public class Pop f 8 static Queue<Integer> myQueue= new LinkedList<>(); public static void main(Stringl args) tf 10e myQueue.offer(new Integer(8)); myQueue.offer(new Integer (16)); System.out.println(myQueue.pol1()); myQueue.offer(new Integer (3)); myQueue.offer(new Integer(12)); myQueue.offer (new Integer(5)): myQueue.offer(new Integer(8)) myQueue.offer(new Integer (6)); myQueue.offer(new Integer(2)); System.out.println(myQueue.pol1)); System.out.println(myQueue.poll()): System.out.println(myQueue.poll()):l 12 13 15 16 17 18 19 20 21 23 24 25 OA. 26 85 O B. 8 16 3 12 c. 16 862 D....

  • I need a java flowchart for the following code: import java.util.*; public class Main {   ...

    I need a java flowchart for the following code: import java.util.*; public class Main {    public static void main(String[] args) {    Scanner sc=new Scanner(System.in);           System.out.print("Enter the input size: ");        int n=sc.nextInt();        int arr[]=new int[n];        System.out.print("Enter the sequence: ");        for(int i=0;i<n;i++)        arr[i]=sc.nextInt();        if(isConsecutiveFour(arr))        {        System.out.print("yes the array contain consecutive number:");        for(int i=0;i<n;i++)        System.out.print(arr[i]+" ");       ...

  • What is the output of the following code? class C1 { public double PI=3.1; public void...

    What is the output of the following code? class C1 { public double PI=3.1; public void m1() { System.out.println("M1 of C1"); } } class C2 extends C1 { public double PI=3.14; public void m1() { System.out.println("M1 of C2"); } } public class C { public static void main(String[] args) { C1 obj = new C2(); System.out.print(obj.PI); } } 3.1 3.14 None of the above

  • What is the output of the code below? public class Hobbits { String name; public static...

    What is the output of the code below? public class Hobbits { String name; public static void main(String [] args) { Hobbits [] h = new Hobbits[3]; int z = -1; while (z < 2) { z = z +1; h[z] = new Hobbits(); h[z].name = "bilbo"; if (z == 1) { h[z].name = "frodo"; } if (z == 2) { h[z].name = "sam"; } system.out.println(h[z].name + " is a "); system.out.println("good Hobbit name"); } } } Output: a. bilbo...

  • Java Project Draw a class diagram for the below class (using UML notation) import java.io.BufferedReader; import...

    Java Project Draw a class diagram for the below class (using UML notation) import java.io.BufferedReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; public class myData { public static void main(String[] args) { String str; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter text (‘stop’ to quit)."); try (FileWriter fw = new FileWriter("test.txt")) { do { System.out.print(": "); str = br.readLine(); if (str.compareTo("stop") == 0) break; str = str + "\r\n"; // add newline fw.write(str); } while (str.compareTo("stop") != 0); } catch (IOException...

  • What is the output of the following question? import java.io.IOException; import java.util. EmptyStackException: public class newclass...

    What is the output of the following question? import java.io.IOException; import java.util. EmptyStackException: public class newclass public static void main(String[] args) try System.out.printf("%d", 1); throw (new Exception()); catch (IOException e) System.out.printf("%d", 2); catch(EmptyStackException e) System.out.printf("%d", 3); catch(Exception e) System.out.printf("%d", 4); } finally System.out.printf("%d", 5); Q3) (15 points) a.Write a JAVA program that reads an arra JAVA program that reads an array from input file and invo Sort and Max ,that sorts the elements of the array and s the elements...

  • What will be the output of the following Java code? class Output { public static void...

    What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } } a) 0 b) 1 c) false d) true

  • Question 2 What is the EXACT output of this code: class B { public B{ System.out.print("B");...

    Question 2 What is the EXACT output of this code: class B { public B{ System.out.print("B"); } } class A extends B{ public A(int t) { super(); System.out.print("A"); } } public class Test{ public static void main(String[] args) { A a = new A(3); } }

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT