Skip to main content

creating object invoking various methods

Define a class named College as described below: 

Data Members: 1) collegeName
2) principalName
3) place

Methods : 1) constructor.
2) display() to display the collegeName, principalName, and the place.

Test this class by creating an object and then invoking the various methods.




class collegeName{ 
public String collegeName; 
public String PrincipalName; 
public String place; 
public collegeName(){ 
public void display(){ 
System.out.println("College name is "+this.collegeName); 
System.out.println("Principal name is "+this.PrincipalName); 
System.out.println("Place is "+this.place); 
class displayName{ 
public static void main(String[] args) { 
collegeName c = new collegeName(); 
c.collegeName="Siliguri Institute of Technology"; 
c.PrincipalName="Dr. Mithun Chakraborty"; 
c.place="Siliguri"; 
c.display(); 
}


OUTPUT:

College name is Siliguri Institute of Technology
Principal name is Dr. Mithun Chakraborty
Place is Siliguri


Comments

Popular posts from this blog

Function Keys Shortcuts

Function Keys Shortcuts (F1 - F12) (Function Keys) F1 It is used to open the help window in almost all programs. Also used to enter BIOS or CMOS Some computers allow you to enter BIOS setup using different keys like F2, F10, Delete, Esc. Pressing Window + F1 will open the Microsoft Windows Help and Support Center. F2 In Microsoft Windows, it is used to rename an icon , file , or folder that the user selects. In Microsoft Excel, the F2 key allows you to edit the selected cell in the Excel sheet. In Microsoft Word, pressing Ctrl+F2 will open the print preview window and Alt+Ctrl+F2 will open the new file or document. In addition, it is also used to enter the CMOS setup. F3 It is mainly used to open a search function for many programs. At the MS-DOS or Windows command line, it gives users the option to repeat the last command entered. In Microsoft Word, if you press Shift + F3 , it allows you to change the selected text from uppercase to lowercase or a capital letter at the beginni...

Top 10 Most Famous Photographers of All Time

*Top 10 Most Famous Photographers of All Time* If you want to take truly memorable and moving photographs, you can learn something by studying the pictures of famous photographers. Some of the most beloved artists are deceased, but some are still delighting us with their photographs. The list below includes some of the more famous photographers that still impact our lives today. 1. *Ansel Adams* is probably the most easily recognized name of any photographer. His landscapes are stunning; he achieved an unparalleled level of contrast using creative darkroom work. You can improve your own photos by reading Adams’ own thoughts as he grew older, when he wished that he had kept himself strong enough physically to continue his work. 2. *Yousuf Karsh* has taken photographs that tell a story, and that are more easily understood than many others. Each of his portraits tells you all about the subject. He felt as though there was a secret hidden behind each woman and man. Whether he captures a gl...

Computer Fundamentals in Hindi

Computer Fundamentals in Hindi - कंप्यूटर फंडामेंटल्स हिंदी में - कंप्यूटर का परिचय कंप्यूटर शब्द अंग्रेजी के "Compute" शब्द से बना है, जिसका अर्थ है "गणना", करना होता है इसीलिए इसे गणक या संगणक भी कहा जाता है, इसका अबिस्कर Calculation करने के लिए हुआ था, पुराने समय में Computer का use केवल Calculation करने के लिए किया जाता था किन्तु आजकल इसका use डाक्‍यूमेन्‍ट बनाने, E-Mail, Listening And Viewing Audio And Video, Play Games, Database Preparation के साथ-साथ और कई कामों में किया जा रहा है, जैसे बैकों में, शैक्षणिक संस्‍थानों में, कार्यालयों में, घरों में, दुकानों में, Computer का उपयोग बहुतायत रूप से किया जा रहा है। Computer केवल वह करता है जो हम उसे करने का कहते हैं यानि केवल वह उन Command को फॉलो करता है जो पहले से Computer के अंदर डाले गए होते है, उसके अंदर सोचने समझने की क्षमता नहीं होती है, Computer को जो व्यक्ति चलता है उसे यूजर कहते है, और जो व्यक्ति Computer के लिए Program बनता है उसे Programmer  कहा जाता है। कंप्यूटर को ठीक प्रकार से कार्य करने के लिए सॉफ्टव...