What is a compiled program that runs on the client?
The program that runs on the client computer is the client program. Web-browser is a prominent example for client program.
Largest palindrome substring of a string?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector; /**
*
*/ /**
* @author omnipath
*
*/
public class Palindrome { /**
* @param args
*/
public static void main(String[] args) { // open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String string = null; // readLine() method try { string = br.readLine(); } catch (IOException ioe) { System.out.println("IO error trying to read input!"); System.exit(1); }
Palindrome palindromeCase = new Palindrome(string);
System.out.println("The longest palindrome is: " + palindromeCase.palindrome);
System.out.println("The length of the longest palindrome is: " + palindromeCase.palindrome.length());
System.out.println("Counter is: " + palindromeCase.PalindromeCounter);
} String originalString;
String palindrome;
Vector vectPalindromes;
int palindromeLength;
int PalindromeCounter; public Palindrome(String s) {
PalindromeCounter = 0;
this.palindrome = "";
this.palindromeLength = this.palindrome.length();
this.originalString = s;
this.calculateLongestPalindrome(s);
} public void calculateLongestPalindrome(String s) {
if (s.length() == 1) {
this.palindrome = this.originalString;
this.palindromeLength = this.palindrome.length();
} this.parseForPalindrome(this.originalString); } public void parseForPalindrome(String s) {
PalindromeCounter++;
if (s.length() -1; i--) {
sb.append(s.charAt(i));
}
return sb.toString();
}
}
How do we pass array to function of java?
Let the function be private void processArray(int[] arInts); to call this 1. Create a local array variable, set the values and pass it int[] arIntInp = {0,1,3}; processArray(arIntInp); 2. Create an array on the fly and pass it processArray(new int[]{0,9});
C plus plus supports more object oriented Programming features as compared to JAVA?
No. Java is 100% OOP while C++ supports the concept of primitives (which it inherited from C). Thus C++ supports far more features than Java, but it does not support any more OOP features than Java. Note that there are only four primary OOP features: encapsulation, abstraction, inheritance and polymorphism. Anything beyond that is implementation-specific and outwith the scope of OOP.
What is the difference local applet and remote applet?
A LOCAL applet is the one which is stored on our computer system.when browser try to access the applet, it is not necessary for our computer to be connected to The Internet. A REMOTE applet is the one which is not stored on our computer system and we are required to be connected to the Internet. PARITOSH Khanna Happy Programing
What are the differences between objects and classes in java?
A class is basically a definition, and contains the object's code. An object is an instance of a class. For instance, there is one java.lang.String class, but you can instantiate any number of distinct java.lang.String objects (instances). While a class defines the instance variables than an object has, the instantiated object itself actually contains those variables. So to put it simply: An object is an instance of a class.
Why we can't use super and this keywords in the same constructor?
because, the super refers to the constructor of the parent class while this refers to the constructor of the current class. Either statements must be the first line in a constructor. So, since we cannot have two first lines in a method we cannot have both keywords in the same constructor.
public RandomTest() {
super();
this();
}
The above code will never compile. Even if we flip the positions of super and this, we will get the same compilation error.
What does the word part void mean?
void basically signifies that the method will not have a return value.
Explain different types of comment line in JAVA?
// The first type of comment is the single-line comment. // The single-line comment is denoted by a double slash. /* The next type of comment begins with a slash-asterisk, and ends with an asterisk-slash. It is often called a multi-line comment because it can span multiple lines with only one start indicator (/*) and one ending indicator (*/) */ /** * The last type of comment is the Javadoc comment. This * comment type has some guidelines that allows a Javadoc * reader to display information about a Java method or class * by using special tags: * * @param myNum - describe what the parameter myNum is used for * @return - describe what this method returns */ public static int doStuff(int myNum){}
How do you compare 2 lists in java?
First we need to have two lists whcih we need to compare.
and try to incorporate it in below code :
import java.util.*;
public class ExampleTry {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
List
al1.add("a1");
al1.add("a2");
al1.add("a3");
List
al2.add("a1");
al2.add("a2");
al2.add("a3");
al2.add("a4");
al2.add("a5");
for(Object objList:al1){
if(al2.contains(objList)){
al2.remove(objList);
}
}
System.out.println("Value in list"+al2);
}
}
Output :
Value in list[a4, a5]
Code to add 2 integer numbers without using int float and double?
int num1 = 1;
int num2 = 50;
int addition = num1 + num2;
Which keyword is used to declare constants and variable?
Constants are defines using the final keyword.
Variables are defined using the one of the keywords:
char
boolean
int
double
longint
String
To use a constant you would have to put in something like
double final pi = 3.14;
What is a Boolean or logical data type is used to store?
A Boolean or logical data type can be used to store anything that can answer a "yes/no" question. In other words, anything that has two options. For example:
Firstly you would need to get the user input and initialize some variables (This is all done in C#):
string text = Console.ReadLine();
int numberOfEven = 0;
int numberOfOdd = 0;
int numberOfZero = 0;
int number = 0;
Then you would need to loop through the string to see for the odd and even numbers:
while(number < text.Length) // Loops through how many times there are // numbers in the string
{
if (text[number] 0) // Just like the one before, checks if it is // odd
{
numberOfOdd ++;
}
number ++;
}
And you can print off each of the integers to get how many evens, odds and zeros there are.
Static method can be overridden?
Depends. A non-static method that is declared final cannot be overridden. A non-static method in a final class cannot be overridden. A non-static method that is declared private cannot be overridden. A non-static method that is declared with package visibility cannot be overridden by classes in a different package.
Other than that, yes.
How do you make an program in object oriented programming?
Object Oriented Programming is the technique to create programs based on the real world..object oriented programming model programs are organized around objects and data rather than actions and logic. In OOP based language the principal aim is to find out the objects to manipulate and their relation between each other.OOP offers greater flexibility and compatibility and is popular in developing larger application.
What is inheritance explain with an example?
Inheritance is a feature in Java wherein one class will inherit or use the features of another class.
Ex: public class A extends B {
…
}
Here class A is the child class and B the parent. The child inherits the features/methods of the parent and can use them.
A variable data is anything that won't necessarily be the same every time you run a computer program. It may come from user input, from a random function, from consulting a database, etc.
What is object oriented paradigm in java?
the concept of "pure" in object orientation is a little subjective and not quite well defined in practice, but there are pure object oriented programming languages. The principles of object orientation on the other hand are well defined. Programming languages are quite nested in complicated materials, and it is hard to say that everything must be an object, since all formal systems need primitives. How can you define an object without the notion of an object as a definition? This all comes down to type theory, and one can't define everything as "something" without knowing the "something". With this, Java is not actually a pure object oriented programming language since it needs primitives. The only way you can yield a pure programming language with no primitives is not even having the notion of defining concrete terms in a programming language since it doesn't have primitives in it.
Smalltalk is an example of a pure programming language. With this, I can't exactly answer the question since you've presented two OO programming languages, neither of which is "pure".
-Fabianski Benjamin
India
What year java was implemented?
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform.
Newer versions of Java have been released on a regular basis...
Java was originally developed by James Gosling at Sun Micro systems and was released in 1995. This language was re-written many times and updated with more classes and packages. One man that made a great contribution to these updates is a man named Bill Joy, also known as "The einstein of the internet."
What are multithreading concepts in java?
Multithreading in Java is the concept by which you can have multiple threads of execution running in parallel. Unfortunately the topic is too big to be summarized in one answers. You can check the related links section for links that can help you understanding this complex topic
Compile Time: In longer form, you might say, "at the time of compiling", or, "when the program is compiled".
When you compile a program, the compiler applies various processes to your source code in order to generate the executable files. These are actions that happen "at compile time".
Other actions happen when you actually run the finished program. These actions are said to occur, at, or in, "run time".
Why is java is neutral platform independent?
Java solves the problem of platform-independence by using
byte code. The Java compiler does not produce native
executable code for a particular machine like a C compiler
would. Instead it produces a special format called byte
code. Java byte code written in hexadecimal, byte by byte,
looks like this:
CA FE BA BE 00 03 00 2D 00 3E 08 00 3B 08 00 01 08 00 20 08
This looks a lot like machine language, but unlike machine
language Java byte code is exactly the same on every
platform. This byte code fragment means the same thing on a
Solaris workstation as it does on a Macintosh PowerBook.
Java programs that have been compiled into byte code still
need an interpreter to execute them on any given platform.
The interpreter reads the byte code and translates it into
the native language of the host machine on the fly. The most
common such interpreter is Sun's program java (with a little
j). Since the byte code is completely platform independent,
only the interpreter and a few native libraries need to be
ported to get Java to run on a new computer or operating
system. The rest of the runtime environment including the
compiler and most of the class libraries are written in Java.
All these pieces, the javac compiler, the java interpreter,
the Java programming language, and more are collectively
referred to as Java.
What is concrete class in java?
A method which is not abstract i.e. if a methods definition is given in the same class its declared is called concrete. where as abstract method would have no definition till the deep down of the hierarchy of class structure but ll ve a declaration in all the subclasses and definition in one subclass after which it need not be declared in the further subclasses. By the way defining the abstract method in a subclass would end the carrying of the declaration till down, but defining it is not mandatory where declaring is mandatory.