We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Java
  3. Introduction
  4. Java Stdin and Stdout I
  5. Discussions

Java Stdin and Stdout I

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 456 Discussions, By:

recency

Please Login in order to post a comment

  • thesuddenflames
    7 days ago+ 0 comments

    Hi. I'm new here. Don't know much about coding. But tried a diff way to solve the challenge. is it ok?

    import java.io.; import java.util.;

    public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner scanner = new Scanner(System.in);
        String myString = scanner.next();
        int myInt = scanner.nextInt();
        int lastInt = scanner.nextInt();
        scanner.close();
    
        System.out.println(myString);
        System.out.println(myInt);
        System.out.println(lastInt);
    }
    

    }

    0|
    Permalink
  • savithavaranasi2
    2 weeks ago+ 1 comment

    can anyone tell me the actual code of this program

    0|
    Permalink
  • thapat_paj
    3 weeks ago+ 0 comments

    import java.util.Scanner;

    public class Solution {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int myInt = scanner.nextInt();
        String myString = Integer.toString(myInt);
        do {
        System.out.println(myInt);
        myInt = scanner.nextInt();
        myString = Integer.toString(myInt);}
        while (myString != "");
    

    }}

    0|
    Permalink
  • helenabraham789
    1 month ago+ 0 comments
    import java.io.*;
    import java.util.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            
            Scanner sc = new Scanner(System.in);
            
            while (sc.hasNext()){
                int num = sc.nextInt();
                System.out.println(num);
            }
            
            
        }
    }
    
    1|
    Permalink
  • ashish_bvj
    1 month ago+ 0 comments

    Just tried an another way of solving the problem.

    public class Solution {
    
        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            int inputArray[]=new int[3];
            for (int i=0;i<3;i++){
                int a = scan.nextInt();
                inputArray[i]=a;
            }
            
            scan.close();
    
            for (int num:inputArray){
                System.out.println(num);  
            }
    
        }
    }
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy