sparse array is one which has contents lower than its maximum size, that is the array has free or empty locations....
The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface
What is the meaning of the word methods?
Methods is defined as a procedure for approaching something. For example, you think of a method of how you are going to finish certain tasks which you need to get done at night.
What are limitations of double indicator method?
I know I know!!!! Its my fat juicy coc that you gotta slurp to get the answer.
Which highest level event class of the event delegation model?
The java.util.EventObject class is the heighest-level class in the event-delegation model class hierarchy.
Can you override the constructor?
A constructor should be overloaded when there is a parameter with default value that is commonly used, or if it is possible that not all the information for creating the instance will be gathered all at once. As an example, say there is a class that describes bank accounts. Assuming I can choose to deposit or not deposit money under my name upon creating an account, there is a chance for a meaningful overload. One constructor could take in the name of the account owner and the initial balance as parameters; the overloaded constructor could just take the name as a parameter while setting the initial balance to zero.
What is the difference between platform independent and portable in programming?
There is no difference. They mean exactly the same thing. Portable code is independent of the platform while non-portable code is platform-dependant.
Must all final variables be compile time constants?
No, it is not mandatory. As long as a final variable is initialized only once during the sequence of the code flow, the compiler would not complain.
Ex:
public class Test {
final int x;
public void assignVal(int val){
if(val > 100) {
x = val;
}
}
}
The above code will compile and run just fine as long as there is no other line in the code that assigns a value for x.
Why is argentrometric method called as a mohr method?
The argentometric method is called the Mohr method because it was developed by the German chemist Karl Friedrich Mohr in the 19th century. This titration technique involves the use of silver nitrate as a titrant and is specifically used for the determination of chloride ions in a solution. The method is characterized by the formation of a colored precipitate (silver chromate) at the endpoint, which occurs when all chloride ions have reacted, indicating the completion of the titration.
There are many ways of solving this problem using primitive types. However, if you are willing to sacrifice some memory, you can use BigInteger's gcd() method to make things easy.
Example:
public static int gcd (int[] numbers)
{
BigInteger k = BigInteger.ZERO;
for (int n : numbers)
k = k.gcd(new BigInteger(""+n));
return k.intValue();
}
Which sign is used to concatenate two strings?
That depends on the programming language. Most languages use the "+" sign, but a few use other signs. For example, PHP uses the dot.
When possible you should advoid using what variables in a program?
Global Variables
Or: variables with names longer than 128 characters.
Can a string value be enclosed in double quotes?
Yes, that is the standard in many programming languages.
Yes, that is the standard in many programming languages.
Yes, that is the standard in many programming languages.
Yes, that is the standard in many programming languages.
The default base is always required in the switch selection structure true or false?
False. The Default section of a switch case section is not mandatory. the programmer can choose to have it if he wants to implement a default functionality in cases where none of the cases match the conditions.
Does the abstract classes contain implementation for methods?
An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.
Ex:
abstract class Parent {
public abstract String getSon();
public abstract String getDaughter();
....
....
//More methods that contain specific behaviour/code in them
}
The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.
i.e., the below piece of code will not work. The code will not even compile.
Parent object = new Parent();
Purpose of Abstract Classes:
Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.
A Child Class extending the Abstract Class:
public class Child extends Parent {
public String getSon() {
return "Sons Name";
}
public String getDaughter(){
return "Daughters Name";
}
...
... //Code specific to the Child class
}
You can also have methods that have code implementation in the abstract class but those methods cannot have the abstract keyword in their method declaration.
// Infinite while loop
while(true) {
System.out.println("Still looping...");
}
// More useful while loop to move through all elements in a Queue
Object currentItem;
while((currentItem = queue.poll()) != null) {
System.out.println(currentItem);
}
What characters mark the beginning of a multiline comment in Java?
The so-called "multiline commend" (which can also be used for inline comments) start with /* and end with */. Here is an example:
/* This is a
multiline
comment */
What is the parameter specification for the public static void main method?
The Main method is the method in which execution to any java program begins.
A main method declaration looks as follows:
public static void main(String args[]){
}
The method is public because it be accessible to the JVM to begin execution of the program.
It is Static because it be available for execution without an object instance. you may know that you need an object instance to invoke any method. So you cannot begin execution of a class without its object if the main method was not static.
It returns only a void because, once the main method execution is over, the program terminates. So there can be no data that can be returned by the Main method
The last parameter is String args[]. This is used to signify that the user may opt to enter parameters to the java program at command line. We can use both String[] args or String args[]. The Java compiler would accept both forms.
What is nano programming and uses?
Nano programming is a set of programs that execute small specific processes, such as turning logic blocks on and off. It is used in micro processors.
What is 8 queen problem explain?
public class NQueens {
private static int[] b = new int[8];
private static int s = 0;
static boolean unsafe(int y) {
int x = b[y];
for (int i = 1; i <= y; i++) {
int t = b[y - i];
if (t x) ? "|Q" : "|_");
}
System.out.println("|");
}
}
public static void main(String[] args) {
int y = 0;
b[0] = -1;
while (y >= 0) {
do {
b[y]++;
} while ((b[y] < 8) && unsafe(y));
if (b[y] < 8) {
if (y < 7) {
b[++y] = -1;
} else {
putboard();
}
} else {
y--;
}
}
}
}
An interface can have private instance attributes?
No.
The private modifier says that no other class can see that attribute. Since interfaces cannot contain any implemented methods (no functional code), there would be no reason to allow for private members of an interface.
Why in java interface is used for multiple inheritance not by extends?
Since an interface has no implemented methods, there is nothing to extend, since you would simply get empty method headings you can't make a class by extending an interface. An interface must be implemented, by filling in the method bodies. An interface is a tool to define common characteristics between classes, i.e. how they act. For instance, an interface might be used to define a window, a simple generic window: it opens, closes, breaks.
Interfaces are useful to the client since you don't need to know the inner workings of the class to use it, for instance, as long as you know the data structure you are working with is a List, you don't need to know whether it is an ArrayList or LinkedList.