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

JS Code for Generating OTP

JS Code for Generating OTP -  * Learn how to create a simple JavaScript function to generate a random 4-digit OTP. (GENERATED BY - ChatGPT) function OTP() { let otp = ""; otp = Math.floor(Math.random() * 9000 + 1000); return otp; } console.log("Your OTP is-", OTP());

What is E. coli? What is it use as a model organism in Metabolic engineering?

What is E. coli? Ans.   E. coli is a Gram-negative rod-shaped bacterium that is typically around 1 μm long and 0.35 μ m wide. It is able to survive with or without oxygen and thus is a "facultative aerobe". Although it is able to grow fast without forming clumps in various inexpensive chemically defined media, it is not typically tolerant to very high or low temperatures or extreme acidity/alkalinity. Its potential for fast growth, the number of molecular techniques for genetic manipulations available, and a good amount of knowledge about its genetics mean that it has the versatility to be utilized in many ways. Also,  E. coli  mainly replicates asexually, meaning that modifications made to the genome are maintained and thus effects seen in these mutants are reproducible. These factors make  E. coli  a good model organism for molecular genetics. E. Coli Symptoms Ans.   Symptoms of  E. coli  typically set in within 2-3 days of infection. Symptoms ...

All About Microservices Architecture

All About Microservices Architecture **Microservices Architecture** is an approach to software development where a large application is broken down into smaller, independent services that can operate and be deployed independently. Instead of building a monolithic application, which is a single, tightly-integrated unit, microservices architecture divides the functionality into separate services that communicate with each other through well-defined APIs (Application Programming Interfaces). Key characteristics of microservices architecture include: 1. **Modularity:** Each microservice represents a specific business capability and can be developed, deployed, and scaled independently. 2. **Independence:** Microservices are autonomous, meaning they can be developed, deployed, and updated without affecting the entire system. This independence allows for faster development cycles. 3. **Scalability:** Since each service is independent, you can scale only the specific microservices that require...