- import java.util.*;
- public class Main {
- public static void main(String[] args){
- //fill the code here
- Scanner sc= new Scanner(System.in);
- System.out.println("Enter the country name");
- String s=sc.nextLine();
- System.out.println("Enter the country code");
- String c=sc.nextLine();
- System.out.println("Enter the isd code");
- String n=sc.nextLine();
- Country co=new Country(s,c,n);
- System.out.println("Country Name : "+co.getCountry());
- System.out.println("Country Code : "+co.getCode());
- System.out.println("ISD Code : "+co.getNum());
- }
- }
- public class Country
- {
- // Instance Variables
- String name;
- String countryCode;
- String isdCode;
- // Constructor Declaration of Class
- public Country(String name, String countryCode,String isdCode)
- {
- this.name = name;
- this.countryCode= countryCode;
- this.isdCode= isdCode;
- }
- // method 1
- public String getCountry()
- {
- return this.name;
- }
- public String getCode()
- {
- return this.countryCode;
- }
- public String getNum()
- {
- return this.isdCode;
- }
- }
[text] QWERTY7897987
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: