java has five types of keywords
those are:
1.system package
2.utilities package
3.networking package
4.Abstract Window Tool package
5.applet package
What statements about public access information are correct?
It is cleared in the same manner as hard copy information is cleard and it needs to be cleared for unlimited access by the Public Affairs Office.
it is cleared in the same manner as hard copy information is cleared
it needs to be cleard for unlimited access by the public affairs office
Can a derived class pointer be converted into a pointer to its public base class?
Yes, via a static up-cast. Up-casting to a base class is always safe so there's no need to dynamically cast (dynamic casting is only a requirement when down-casting, but even then that's usually a sign of a poorly-designed virtual interface).
Consider the following classes:
class A{};
class B : public class A{};
If we create an instance of B we can then point at that instance using a derived class pointer:
B b;
B* pb = &b;
To "convert" pb to a base class pointer we statically cast it like so:
A* pa = (A*) pb;
Or, more simply, we can just point at the derivative's address:
A* pa = &b;
Note that we don't actually convert anything. Although pa points to the base class, the actual instance we're pointing at is still a derived class. This is what enables us to pass pointers and references to derived classes into functions that actually expect pointers or references to base classes. Even though those functions can have no prior knowledge of what derivatives it might receive in the future, they simply don't have to. As far as the functions are concerned, you've passed a base class, not a derivative. But if you call a virtual method of the base class then the derived class method will be called instead -- and that's precisely what one expects of a derivative. This is how inheritance and polymorphism work.
If you really want to convert to a base class (completely eliminating the derived class), then you must call the base class copy constructor, passing the derived class as the argument:
B b;
A a(b);
Note that a and b are now completely separate instances and a is nothing more than the base class component of b, devoid of all its derived class components. Thus if you were to mutate a, you will not mutate b, and vice versa. The casts shown previously do not create separate instances -- there is only the one instance -- so any mutations affect all pointers to that one instance, whether they be base class pointers or derived class pointers.
You can also use the copy constructor to point at a new instance of the base class, creating the new instance on the heap rather than the stack:
A* pa = new A(b);
In order to make use of A's assignment operator, you must provide a cast operator in B:
class B : public A
{
public:
operator A(){return(A(*this));}
};
Now you can perform the following assignment:
A a;
B b;
a = b;
Note that a and b remain completely separate instances.
Hello anyoneCan you please explain the terms light weight and heavy weight in java?
Lightweight framework do not have to depend on framework interfaces or abstract classes to hook or instantiate components into them.
Heavyweight frameworks on the other hand require the extension of framework classes or the implementation of framework interfaces in order to take advantage of their middleware features.This means that a lot of classes are instantiated and hooked on to your application when they may not be even required!!
How do OO analysis and design facilitate reusability?
Through the use of interfaces and abstract classes that define common behaviors
Though implementing Runnable interface is better approach than inheriting from Thread class but there are certain methods available in Thread class like join,sleep or yield which does not available in Runnable interface and programmer can not use them unless he has object of Thread class. This is why we should have Thread class Object.
Rupesh Raghani
Convert jar file into txt file?
This site has a program that lets you convert .txt to .jar . Perhaps it allows you to do the reverse , try it out. http://forum.mobiles24.com/showthread.php?t=15234
Here is a Chinese program that lets you convert jar to txt.
Is it possible to initialize null character in string?
How do you find flames using string?
I'm not sure what your asking. Is flames another string or the contents of a string?
I can't answer your question because your either asking something way beyond or ask something that has no answer.
Java support system includes:
· Applets
· Servlets
· Java Beans
· EJB
· JSP
· XML
· SOAP
· CORBA
How many number of argument are there in round method?
The round method of the Math class is overloaded. You can either pass a double or a long into the round method
When class definition not found error will occur?
This error occurs when you try to run a java program and the JVM (java virtual machine ) do not found the class file for your program.
there are two reasons for this kind of error to occur
1. If you haven't set the CLASSPATH environment variable for the bin directory of your java installation or to the current directory in which you are working, then JVM will never know where to look for the class files you are trying to load and so the error occurs.
2. you may be trying to run your program with a wrong class name which doesn't exist.
note: this error doesn't mean that there is any error in your code.
Why do you need exception handling codes in a program?
separating error handling code from 'regular' code
A default constructor has how many parameters?
None, zero. Example: new MyClass(); //and public classMyClass{} no constructor defined inside of MyClass
Write a program to calculate the sum of the sequence number from 1 to n loop?
public static final int getSum(final int n) {
int sum = 0;
for(int i = 1; i <= n; ++i) {
sum += i;
}
return sum;
}
Write a program to swap 2 variables with out using 3rd variable through cout?
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a;
cin >> b;
a = a * b;
b = a / b;
a = a / b;
cout << a << " " << b;
char wait;
cin >> wait;
return 0;
}
What is meant by polymorphism?
Polymorphism
Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism. Overloading Polymorphism is the use of one method signature, or one operator such as "+", to perform several different functions depending on the implementation. The "+" operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the addition operator, "+", to work this way. This helps improve code readability. How this is implemented varies from language to language, but most OOP languages support at least some level of overloading polymorphism. Many OOP languages also support Parametric Polymorphism, where code is written without mention of any specific type and thus can be used transparently with any number of new types. Pointers are an example of a simple polymorphic routine that can be used with many different types of objects.
If structure is arraythen an individual array element can be accessed by writing a variable?
A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.
A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.
A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.
A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.
Why matrice's definition includes rectangular array instead of array?
Matrices itself is a combination of rows and columns.we can not use one-dimenssional array to save the values of matrices.instead we use the rectangular array which contains rows and columns.thats it.