Technology Guruu

  • Home
  • Site Info
    • About Us
    • Disclaimer
    • Privacy Polacy
  • Home
  • Digital Marketing
    • SEO
    • SMM
    • SEM
  • Quotes
  • Technical
  • Java
  • .Net
    • C#.Net
    • ASP.Net
  • Keychains

Thursday, 26 January 2017

Best Tutorial of Constructors in OOPS

 Akansha     00:00:00     Java, TechnicalQuestions     No comments   

Constructors and Methods are the heart for our programming languages like java,c#.net,vb.net etc Any developer first know the value of constructors and methods and what are the difference between methods and constructors.How it can be placed in programming development.

Best Description about Constructors in object oriented programming

In object oriented Programming(oops) have many important topics in this constructors is the one of the good topic.Constructors is most relavent asking question in interview purpose for fresher/experience candidates,the frequently asking questions are what is static constructor and dynamic constructor what are the differences.
constructors

In constructors we hava two types
1.Static Constructor
2.Dynamic Constructor
Static Constructor:It is Common for all like college name.
Dynamic Constructor:It is Individuals for all like student rollno.
The following Questions and Answers are give a datail explanation about constructors.

1)what is constructor?

Ans:constructor is a member of a class which is special type of function

2)constructor can have any return type?

Ans:constructor will not return any value.So it will not have return type.

3)Features of Constructor?

Ans:1.class name and construtor name should be same

2.constructor can contain parameters

3.constructor can invoke automatically when an object is created.

4)what is instance constructor?

Ans:while defining a constructor if we did not use static keyword it is called as instance constructor.

5)what is the purpose of instance constructor?

Ans:purpose of instance constuctor is to initialize instance variables.

6)instance constructors can contain parameters or not?

Ans:instance constructor can contain parameters

7)what is static constructor?

Ans:while defining a static constructor if we have used static keyword which is called as static constructor.

8)what is purpose of static constructor?

Ans:static constructor purpose is to initialize instance variables.

9)How to initialize static variable?

Ans:By using static constructor.

10)When we will go for static variable?

Ans:Whenever we want to represent a comman value for all objects we will declare as a static variable.

11)When class will be loading and when class will be unloading?

Ans:Whenever CLR required to execute any part of the class then it will load concern class from application to CLR.
Whenever application execution is completed then all the classes will be unloading.

12)static constructor is a parameterized or parameterless constructor?

Ans:static constructor is a parameterless constructor

13)When static constructor will invoke?

Ans:when class is loading static constructor will be invoke automatically.

14)When instance constructor will invoke?

Ans:when object is created instance constructor will be invoke

15)How many static constructors in one class?

Ans:A class can contain only one static constructor because by default it is a parameterless constructor.

16)If a class is having one instance constructor and one static constructor which will execute first?

Ans:First static constructor will execute next instance constructor will execute because class will load first then object will create.

Example for static constructor and instance constructor

class Employee
{
static Employee()
{
comname="wipro";
}
internal Employee()
{
eno=111;
ename=ram;
esal=5000;
}
Recommended Articles
1.Tutorial of Methods Concept
2.Tutorial of Parameters Passing Mechanism
3.Tutorials of Multiple Inheritance
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Love Failure Quotes and Sad valentines day Quotes
    We Love Someone is a easy process sometime takes long time to love someone love others within short period but anyway always love dependin...
  • Brief description about Delegates
    Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadv...
  • Missing My Friend Quotes : Friendship Day Quotes 2017
    Friends today my article about missing friends and moments with them. Here you are seen the best friendship quotes and some  feelings when...
  • Na Tanu Samjhawan Ki Song lyrics
    Na Tanu Samjhawan Ki Song Lyrics With English Translation Movie : Humpty Sharma ki Dulhaniya Song : Samjhawan Song Singer : Arijit ...
  • Detail Introduction about C#.Net
    Brief Introduction about C#.Net  Introduction C#.Net is the one of the Programming Language the .Net Framework also contains ano...
  • Best Good Afternoon wishes greetings and quotes
    Top Most Good Afternoon Wishes Good Afternoon wishes are gives a relaxation in afternoon time.This wishing can be done between 12 to 3 p...
  • Top 10 valentine's day Quotes and Greetings wishes
    All Lovers have Anxiety in Valentines day because it is a festival to all lovers in these they enjoy a lot and celebrate the Valentine...
  • How to Remove Audio From Any Video Using VLC Media Player?
    Step by Step Procedure for  Remove(Mute) Audio in a Video Using VLC  Player A picture is worth a thousand words and a video is worth a t...
  • Brief Description about Multicast Delegate
    Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time. Multicast ...
  • Connected and Disconnected Data Access Architecture
    The Ado.Net Frame Work Supports Two Models of Data Access Architectures one is Connected Oriented architecture and second One is Disconnec...

Categories

  • Entertainment (67)
  • TechnicalQuestions (58)
  • Quotes (11)
  • C#.Net (8)
  • Java (8)
  • ValentinesDay (4)
  • SEO (3)
  • Home
  • About Us
  • Disclaimer
  • Privacy Policy
  • Sitemap

Copyright © 2015-2017 Good Friends 5.All Rights Reserved• And Our Sitemap • All Logos and Trademark Belongs To Their Respective Owners•