How is memory allocated by new ?A) in a heap b) in a stack b) both a & b c) none of these.
Access the members of child class
How is that we can make a parent class to access the members of child class?
using polymorphism we access child class with the object of base class.
What is the situation you will need to use partial class in .Net
when different programmers work on single project and all write a code in class .Every programmer declare this class as Partial class and implement own code at the end of the day this partial class have all functionality that all programmers put in this class.
Visual Studio uses partial classes to separate auto-generated code from user-generated code. Example:Let us consider that visual studio creates a file called Form1.Designer.cs which holds the designe...
Call the method to presentation layer
If there is a class library called numbers and method add num.How will you call the method to presentation layer?
To call the library number you do following steps First you declare an object of that class and then using that object you call its methods. Example:
Code
Number numobj=new Number(); int res=numobj.ADD(5,9);
Can we provide the constructor in abstact class? If yes why? What is internal mechanism of JVM
Any class be it abstract or not, has a default constructor created by the jvm.
What is a concrete classes? Is Java object class is concrete class?
Concrete class is a class with implementation for all the methods in it. Concrete class defines all the abstract methods of an abstract class which it is extending. Object class is a concrete class.
concrete class is made up of 50% cement n 45% gravels mixed with !/2 glass of water....
Why in C++ (0.1 + 0.1) is not equal to 0.2 ??
The floating-point arithmetic in most computer languages is based on binary fractions (1/2, 1/4, 1/8, 1/16, ...) and not decimal fractions (1/10, 1/100, 1/1000, 1/1000,...)there is no ActionScript Number that is exactly equal to 0.1 because it require an infinite number of binary fractional bits.
Where do you use partial class ? Explain with real time scenario of the usage ?
Splitting the class into multiple files is called as partial class.The compiler treated the files as different classes but during compilation these files will be treated as a single class. Example:If...
First of all abstract is a key word. Abstract classes are having both defined methods and undefined methods. Concrete classes having only defined methods in the case of concrete classes the execution ...
Can any one give a real time example program for abstract class and virtual functions plzzzzzzzz
Int i;void main(){ int j=100,k; cout
Compilation fails, why because it does not have proper syntax and structure.
This program gives error becoz here j=100 but the value of j is not used.
What is the output of this code?
If(condition) { printf("hello"); } else { printf("world"); }
if condition is true then "hello" will print else "world".
We are writing what it actually .I mean it is error object or else other
iserrorpage is attribute of page, While executing the page it throws any errors then it returns Exception Object
If in MyErrorPage.jsp<%@ page isErroPage="true" %>is written it doesn't mean this is an Error Object.If this page is included as error page in any other jsp (suppose MyPage.jsp) us...
Why is multiple inheritance not allowed in Java?
this is so because it leads to a problem called "dirty diamond".
that is, say class B and C inherit from class A.
class B and C might override the methods in A.
Now if D inherits from B and C(multiple inheritance), there would be a problem that which overridden method would it inherit
Due to the naming complexity in Base & Drived classes,
We Can't provide a solution every time using Inheritance with same name of member,methods.
That's why It's not allowed in JAVA.
Imp: Multiple Inheritance is allowed in Java In Only the case of Interfaces.
Is super a keyword or method? Explain why?
This is basically used to call the constructor of the base class. It is a method of course.
super is a keyword in Java because it is defined as keyword in java and super is not a keyword or variable which belongs to any class.
yes it can be done by singliton class
Preventing direct instantiationWe all know how objects are instantiated right? Maybe not everyone? Let's go through a quick refresher.Objects are instantiated by using the new keyword. The new keyword...
What types of diagrams are generally created while designing an use case / functionality ?
Most frequently used diagrams are- class diagram- sequence diagramrarely used- component diagram- package diagramclass diagram a diagram that shows a collection of declarative (static) model elements, such as classes, types and their content and relationshipsequence describes an interaction by focusing...
Class Diagram : They describe the static structure of a system.Package Diagram : Package diagrams organize elements of a system into related groups to minimize depend...
Why friend function cannot be used to overload the assignment operator?
Java is actually designed to work same as C++ but avoid complex features like operator overloading, friend functions, multiple inheritence.
In Java it is not possible to overloading OPERATOR such as +/-/* etc. We can do that is C++.
In Java there won't be any friend function. ...
That is why we can't use friend function overloading in Java
What is differents between object and static object?
An Object is an physical entity of logical class definition, and in Java there is nothing called static object.
in java there is no concept of static object
What is the difference between call by value, call by reference, call by address?
No answers
call by value--->You are passing primitive value for your method argument.
call by ref--->You are passing object
call by address-->reference and address both are same.
In call by value, value is passed and in call by reference, base address is passed.
Run-time polymorphism provides the ability to use late-binding. In other words, the function called or the data member accessed is not determined until run-time and is based on the type that a v...
Purpose of Runtime polymorphism:Run time polymorphism is a mechanism by which a call to overriden function is resolved at runtime rather than compile time.For e.gIf (user clicks link 1) then{obj1.over...
a) In a Heap
When you declare a variable with new keyword its allocated space in heap.because we dynamically create a variable and we create a variable dynamically its allocated space in heap.