Sort by

recency

|

151 Discussions

|

  • + 0 comments

    Through targeted acquisitions, the company is able to bring fragmented healthcare providers under a unified framework Get details here, creating economies of scale and enabling better integration of services. This approach not only increases access to healthcare in underserved regions but also enhances the overall quality and consistency of care by implementing standardized practices and shared technologies across acquired entities.

  • + 0 comments

    This test is broken for Java 15. It will not read in from STDIN. Java 7 and 8 read STDIN and seem to work properly. I had issues with latest Firefox. Java 7 and Java 8 seem to run better on Chrome.

  • + 0 comments

    On Java 15, I get

    ~ no response on stdout ~

    from the code below. Am I missing something?

    public class Solution {
    
        public static void main(String[] args) {
            System.out.println("FOO");
        }
    }
    
  • + 0 comments
    public class InstanceOFTutorial{
    	
       static String count(ArrayList mylist){
          int a = 0,b = 0,c = 0;
          for(int i = 0; i < mylist.size(); i++){
             Object element=mylist.get(i);
             if( element instanceof Student)
                a++;
             if( element instanceof Rockstar)
                b++;
             if( element instanceof Hacker)
                c++;
          }
          String ret = Integer.toString(a)+" "+ Integer.toString(b)+" "+ Integer.toString(c);
          return ret;
       }
    
  • + 0 comments

    import java.util.*;

    class Student {} class Rockstar {} class Hacker {}

    public class InstanceOFTutorial { static String count(ArrayList mylist) { int a = 0, b = 0, c = 0; for (int i = 0; i < mylist.size(); i++) { Object element = mylist.get(i);

            if (element instanceof Student) // 
                a++;
            if (element instanceof Rockstar) // 
                b++;
            if (element instanceof Hacker) // 
                c++;
        }
        String ret = Integer.toString(a) + " " + Integer.toString(b) + " " + Integer.toString(c);
        return ret;
    }
    
    public static void main(String[] args) {
        ArrayList mylist = new ArrayList();
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            String s = sc.next();
            if (s.equals("Student")) mylist.add(new Student());
            if (s.equals("Rockstar")) mylist.add(new Rockstar());
            if (s.equals("Hacker")) mylist.add(new Hacker());
        }
        System.out.println(count(mylist));
    }
    

    }