Why is multiple inheritance implemened through interfaces?
Interfaces have only methods declared and not defined. So that these various methods can be altered or customized or written according to the need. Hence Multiple inheritance is implemented through Interfaces.
Interface is a progam which just declares various methods or functions, so that any user can write the contents of that method declaration.
AnswerTrue Multiple Inheritance refers to the ability to inherit from multiple CLASSES. Thus, a true multiple inheritance language does not use interfaces. However, many single-inheritance languages provide most of the benefits of the multiple inheritance concept by using interfaces (Java, for example).The problem with true Multiple Inheritance is twofold:
(a) at the compiler and runtime level, it is often difficult to determine which method is being referred to, as M.I. can lead to very convoluted (and sometimes conflicting) namespaces
(b) there is no specific superclass, which can lead to problems with determining relationships between classes
Using a S.I. model with interfaces avoids these two problems.
When do you give preference to abstract classs and interface?
Abstract class provides a way of "being a [something like me]", or inheritance
interface provides a set of functionality (contract) as "behaving".
Abstract class provides the single inheritance and perhaps some default implementation, while interface may be implemented by different classes that have nothing to do one and other except the common interface implementation.
The preference I would start with:
Ask yourself that an object should be "Is a something or behave like something". If your answer is "Is a", then abstract class is more likely your good choice. But if your answer is behave like, does not need to Is a, then the interface is the way to go.
When using a For loop what happens when the loop variable is equal to the final value?
That would depend on how exactly you define the three parts of the for loop. A typical for loop, equivalent to "for i = 1 to 10" in other languages, would look like this:
for (int i = 1; i <= 10; i++)
{
...
}
If you change this to:
for (int i = 1; i <= 1; i++)
then the code would still execute once.
How many values can a method return in Java?
A method in java can declare only one return value and type at a time. For ex: a single method cannot have a code that returns a string in some cases and an integer in other cases. Java compiler does not let you do that. You can only have one return type for every method in java.
What is program documentation?
Program documentation is an essential part of any computer program or application. The documentation specifies what each part of the code does, what events will be triggered during the course of the program, and makes sure that no part of the program is accidentally left off the interface or code.
What is the format specifier use with the data type double in c language?
double would be %e, %f or %g (depending on the format you want), long int would be %ld or %lu (signed or unsigned), long double would be %Le, %Lf or %Lg.
What is the importance of thread?
thread is a light weight program . concurrent execution of code can be done by usin threads.thread is a part of the program.
Does your ex have claim to your inheritance?
In general, an ex-spouse does not have a claim to your inheritance, as inheritances are typically considered separate property. However, if the inheritance was co-mingled with marital assets or if it was received during the marriage and not kept separate, there might be exceptions. It's important to consult with a legal professional to understand the specifics of your situation and the laws in your jurisdiction.
Can a Java application have memory leak?
Java has a fairly sophisticated garbage collection system, and in general you don't worry about memory leaks, as they only happen in a few very specific circumstances (notably, when adding listeners to Swing GUI objects and not removing them).
If you need more sophistcated memory management, java provides the clases in the java.lang.ref package.
Write a Java program to accept name and password?
String username=jTextField1.getText();
char[] pw=jPasswordField1.getPassword();
if ((username.equals("muja"))&& (check(pw)))
{
JOptionPane.showMessageDialog(null, "Username and Password is Correct","User Login",JOptionPane.INFORMATION_MESSAGE);
}
else if ((username.equals(""))&& (check(pw)))
{ JOptionPane.showMessageDialog(null, "Enter the UserName","User Login",JOptionPane.WARNING_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(null, "Username and Password Wrong","User Login",JOptionPane.ERROR_MESSAGE);
}
}
Write a program in c to print characters from A to z and Z to A?
Use this code:
#include <iostream>
using namespace std;
int main()
{int x;
for(x=0; x<27; x++)
if(x 26) cout<< "z" << endl;
return (0);
}
What do you mean by extending classes in java?
That's the name used in Java for inheritance. It means that one class has all the behavior of another class; additional functionality can be added to the derived class.
Is PHP a compiler or interpreter?
It is normally interpreted by another computer program. However subsets of the language can be compiled.
How do you add a class or an interface to a package in java?
Well, the process differs whether you are using either an IDE or the command line binaries.
If you are using an IDE, then it is most likely that your IDE comes with extensive functionality for both managing and creating packages. Look under the "Packages" menu, or, when you are using Eclipse, just right click on the package name in the Package Explorer window and a flood of possibilities will come right up.
If you are using the command line binaries, then there are 2 steps to putting your classes in a package. First, you have to put your class or interface in the appropriate folder structure. For example, if you are using the package com.foo.bar.beebop, then you have to put your class in a folder named beebop, which is in a folder named bar, which is in a folder named foo, which is in a folder named com, which is in your class directory. Then, you have to add a package statement, which is only allowed to be at the top of your class file. For example, if you're using the package com.foo.bar.beebop, then put the following statement at the top of your class:
package com.foo.bar.beebop;
Then skip a line, then come your import statements (if you have any), then stick in another line (if you have inport statements), then your class.
Enjoy!
Give 10 example of close loop control system?
1. lightswitch --> light
2. Toaster --> toast (For timer-based toasters, only -- see below)
3. Water faucet --> water flow amount
4. Water faucets (hot/cold) --> water temperature in the sink or shower.
5. Temperature setting for the stovetop --> heat to cook food
6. TV remote control
7. Clothes dryer (timer based)
8. Volume on a stereo / home entertainment system
9. shades / blinds on a window --> 'regulating' the amount of light coming in from the outside.
10.
Closed loop:
1. Thermostat --> furnace (constant temperature)
2. Toaster setting (light/dark) --> toast (IF the toaster has heat sensors)
3. Refrigerator cold/hot setting --> refrigerator inside temperature (constant)
4. Temperatue setting for oven (not stovetop) --> oven temperature constant
5. Clothes dryer with moisture sensor
6. Washing machine water level
What is mean by method invoking in java?
method invoking refers to the action in which we call a Java method from within another java method or class.
Method invocation is analogous to a function call in procedural programming.
Can a java program run on the browser?
No it can't, this is the difference between Java and JavaScript (which don't have that much to do with one-another) Java is more like C in that it can on the web-server or on any computer really, but it is not like JavaScript which runs inside a sandbox inside the browser.
When object is created and destroyed in java?
in java object is created as soon a class comes into picture......and distroyed ehwn exit that class.............
(object) it is running instance .........
submitted by- shreyas joshi..
What are the unique advantages of object oriented programming paradigm?
a. OOP provides a clear modular structure for programs which makes it good for defining abstract datatypes where implementation details are hidden and the unit has a clearly defined interface.
b. OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
c. OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.
Why you are calling java programming language java?
One code to run them all!
All you have to do is write one program and it runs on all 3 of the supported OS.
Cell phones are a little different since they can't support everything PC can. They have their own version of java.
Normally if you have to rewrite bits of your program to get it working on both windows and Mac.
What is Objectives Oriented Evaluation Approach to program evaluation?
Objectives Oriented Evaluation Approach is the means by which the worth or merit of a program is assessed based on the extent to which the objectives or purposes of the program are being achieved.
Assume the question was for C#, not C.
":" is syntax to extend a type. If the type extended from is another class, they form a class hierarchy and the "inheritance" is established:
For example:
class Base {}
class Derived : Base {}
Derived extends Base, and thus inherits from Base.