[text] aa6

Viewer

  1. import java.util.*;
  2. public class Main {
  3.  
  4.         public static void main(String[] args){
  5.                 //fill the code here
  6.                 Scanner sc= new Scanner(System.in);
  7.                 System.out.println("Enter the country name");
  8.                 String s=sc.nextLine();
  9.                 System.out.println("Enter the country code");
  10.                 String c=sc.nextLine();
  11.                 System.out.println("Enter the isd code");
  12.                 String n=sc.nextLine();
  13.                 // Country co=new Country(s,c,n);
  14.                 // System.out.println("Country Name : "+co.getCountry());
  15.                 // System.out.println("Country Code : "+co.getCode());
  16.                 // System.out.println("ISD Code : "+co.getNum());
  17.                
  18.         }
  19.  
  20. }
  21.  
  22.  
  23. //country
  24. public class Country 
  25.     // Instance Variables 
  26.     String cou; 
  27.     String  code; 
  28.     String num; 
  29.    
  30.     // Constructor Declaration of Class 
  31.     public Country(String cou, String code,String num) 
  32.     { 
  33.         this.cou = cou; 
  34.         this.code= code; 
  35.         this.num= num; 
  36.     } 
  37.    
  38.     // method 1 
  39.     public String getCountry() 
  40.     { 
  41.         return cou; 
  42.     } 
  43.    public String getCode() 
  44.     { 
  45.         return code; 
  46.     } 
  47.    public String getNum() 
  48.     { 
  49.         return num; 
  50.     } 
  51. }
  52.  

Editor

You can edit this paste and save as new:


File Description
  • aa6
  • Paste Code
  • 20 May-2024
  • 1.12 Kb
You can Share it: