Similarities between java and visual basic?
PHP is a scripting language mostly used for web development. It is dynamically typed - variable type can change at runtime. You can use procedural or object-oriented approach in PHP and recent versions are adding elements of functional programming too (closures and yielding, for example.) There is no method overloading, but methods and functions can have optional parameters.
Java is strictly object-oriented, compiled to bytecode, and uses strong (statical) typing. Methods can be overloaded by declaring them with different argument types.
There are many differences in syntax as well, and the way environments for development and production are setup and maintained.
Difference between const in C and final in Java?
Static:
we can use the keyword static either to method or to a variable.
when we declare to a method,(eg: public static void main(String args[]),we can use this method without any object.
when we use to a variable,there will be only one instance of that variable irrespective of how many objects that get created of that class.
Final:
Usage of final to method or to a variable makes them as constant. It's value cannot be changed...
What is use of constructor in object oriented programming?
A constructor creates an Object of the class that it is in by initializing all the instance variables and creating a place in memory to hold the Object. It is always used with the keyword new and then the Class name. For instance, new String(); constructs a new String object. Sometimes in a few classes you may have to initialize a few of the variables to values apart from their predefined data type specific values. If java initializes variables it would default them to their variable type specific values. For example you may want to initialize an integer variable to 10 or 20 based on a certain condition, when your class is created. In such a case you cannot hard code the value during variable declaration. such kind of code can be placed inside the constructor so that the initialization would happen when the class is instantiated.
in a way but yea i would not recomend it, it slows down your PC.
How can you insert an integer value to a character array in java?
It depends on what you mean by "convert an int to char".
If you simply want to cast the value in the int, you can cast it using Java's typecast notation:
int i = 97; // 97 is 'a' in ASCII
char c = (char) i; // c is now 'a'
If you mean transforming the integer 1 into the character '1', you can do it like this:
if (i >= 0 && i <= 9) {
char c = Character.forDigit(i, 10);
....
}
What is a definition of data types?
A data type is, well, the type of data. The most common types are strings (text with spaces, punctuation, etc), integers (whole numbers within a certain range, depending on the specific type), and decimal numbers (1.7). Depending on the database software, there will be many other types.
The relational operators: ==, !=, <, <=, > and >=.
p == q; // evaluates true if the value of p and q are equal, false otherwise.
p != q; // evaluates true of the value of p and q are not equal, false otherwise.
p < q; // evaluates true if the value of p is less than q, false otherwise.
p <= q; // evaluates true of the value of p is less than or equal to q, false otherwise.
p > q; // evaluates true if the value of p is greater than q, false otherwise.
p >= q; // evaluates true of the value of p is greater than or equal to q, false otherwise
Note that all of these expressions can be expressed logically in terms of the less than operator alone:
p == q is the same as NOT (p < q) AND NOT (q < p)
p != q is the same as (p < q) OR (q < p)
p < q is the same as p < q (obviously)
p <= q is the same as NOT (q < p)
p > q is the same as (q < p)
p >= q is the same as NOT (p < q)
Any class may be inherited by another class in the same package?
false sealed classes cannot be inherited
Is string a standard java class?
No. A String is handled as an Object. In many cases you can treat it as primitive (and forget that it is an object), but sometimes the difference is relevant. The class is called String - note that it starts with an uppercase "S".
One case where it is important to know that a String is an object is when comparing strings. You can't simply use the ==operator; instead, you have to use the .equals()method.
No. A String is handled as an Object. In many cases you can treat it as primitive (and forget that it is an object), but sometimes the difference is relevant. The class is called String - note that it starts with an uppercase "S".
One case where it is important to know that a String is an object is when comparing strings. You can't simply use the ==operator; instead, you have to use the .equals()method.
No. A String is handled as an Object. In many cases you can treat it as primitive (and forget that it is an object), but sometimes the difference is relevant. The class is called String - note that it starts with an uppercase "S".
One case where it is important to know that a String is an object is when comparing strings. You can't simply use the ==operator; instead, you have to use the .equals()method.
No. A String is handled as an Object. In many cases you can treat it as primitive (and forget that it is an object), but sometimes the difference is relevant. The class is called String - note that it starts with an uppercase "S".
One case where it is important to know that a String is an object is when comparing strings. You can't simply use the ==operator; instead, you have to use the .equals() method.
What is the importance of overloading and overriding?
The only disadvantage of operator overloading is when it is used non-intuitively. All operators must behave with predictable results, thus it makes no sense to implement the plus (+) operator so that it behaves like a subtract (-) operator, or a multiply (*) operator, or indeed anything other than the intuitive sum of two objects.
What is the purposes of generics in Java programming?
Generics are a part of generic programming within Java. They are commonly used to hold objects of any type, within a Java Collection Framework (JCF), and are a reusable data collection tool.
Enum in java is a keyword which is introduced in JDK 1.5 and its a type like Interface and Class.Enum constants are implicitly static and final and you can not change there value once created. Enum in Java provides type-safety and can be used inside switch statment like int variables. Since enum is a keyword you can not use as variable name and since its only introduced in JDK 1.5 all your previous code which has enum as variable name will not work and needs to be refactored.
How do you run jar file on computer?
you can play the jar files by transfer it in to nokia mobile phones
How does java achieve run time polymorphism?
Polymorphism is Greek for "many forms". There are two types of polymorphism: static and dynamic. Static polymorphism occurs at compile time and is also known as compile time polymorphism. Dynamic polymorphism occurs at runtime and is also known as runtime polymorphism.
Runtime polymorphism is a primary feature of the object-oriented programming paradigm. We achieve runtime polymorphic behaviour by defining virtual methods in a base class which derived classes can then override in order to provide more specialised implementations. Whenever we invoke one of these methods, the most-specialised override is executed automatically. In other words, polymorphic objects will behave according to their runtime type even when the runtime type cannot be determined at compile time.
What are java tokens used for?
In a Java program, all characters are grouped into symbols called tokens. Larger language features are built from the first five categories of tokens (the sixth kind of token is recognized, but is then discarded by the Java compiler from further processing). We must learn how to identify all six kind of tokens that can appear in Java programs. In EBNF we write one simple rule that captures this structure: token <= identifier| keyword | separator | operator | literal | comment The different types of Tokens are:
# Identifiers: names the programmer chooses # Keywords: names already in the programming language # Separators (also known as punctuators): punctuation characters and paired-delimiters # Operators: symbols that operate on arguments and produce results # Literals (specified by their type) #* Numeric: intand double #* Logical: boolean #* Textual: char and String #* Reference: null # Comments #* Line
In java what is the difference between an object and a class?
An object is an _instance_ of a class. A good example is to think of a class as a blueprint for a house, whereas an object is the actual house. You can have many, many houses (objects) build from the same blueprint (class)
What is the Difference between core java and java?
Core Java has to do with the basic package of Java objects that are typically used for general desktop applications. These objects come in the 'Standard Edition' of Java
Advanced Java could actually refer to any advanced topic having to do with Java programming-- and there are many.
The other packages that you will typically see being referred to in opposition to Core Java are Enterprise Java and Micro Edition. Enterprise Java is largely business and network oriented, and Micro Edition is what is typically used for hand-held devices.
The difference is that core java is the fundamental for java that will be used in any java technology without this no one can jump on any advance java technology.
Where as advance java is specialisation in some domain, such as networking, web, DCOM or database handling.
And more over core java packages are always started with "java"
e.g.java.lang.....
where as advance java are always with "javax"
e.g.
javax.servlet....
Core Java uses the console for Input and output i.e - DOS Prompt
Advanced Java is more on the GUI side with a Window,Buttons,Frames,TitleBar,etc.
and is used to create more client-server based applications and applets.
How do classes help us to organize your programs?
Classes and packages together help us organize our programs. They help us split logically related functionality or pieces of code into separate classes and packages thereby helping us in maintaining them in future. for ex: I will put all the class related to the user login functionality inside one package and so in future if I have to make any changes to that feature, I can simply go to that package and do what I want.
Write a java program to print the following output using the for loop 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5?
12345
1234
123
12
1
Java script program to Print the Fibonacci series using array?
<script type = "text/javascript">
var input;
var rev = 0;
input=window.prompt ("Please enter a 5-digit number to be reversed.");
input = input * 1;
while (input > 0)
{
rev *= 10;
rev += input % 10;
input /= 10;
}
document.write ("Reversed number: " + rev);
</script>
What are the synchronized methods and synchronized statements in java?
Synchronized Methods are methods that have the keyword synchronized in the method signature.
Synchronized statements are pieces of java code that are surrounded by brackets which have the keyword synchronized qualifying them.
Both cases mean that - only one thread will be able to access the method or the statement that is synchronized
Bin contains all tools such as javac,appletviewer,awt tool etc where as lib contains API and all packages.
The bin folder contains the binaries - the actual executable programs. The lib folder contains the libraries upon which the binaries are built.
Here is a code snippet illustrating exception handling:
try {
int a= 3 / 0 ;
} catch ( ArithmeticException e ) {
System.out.println ("An ArithmeticException has occured");
} finally {
// some code
}
Tell you difference between c and java?
Apart from the obvious differences in syntax the single biggest difference is that Java is an object orientated programming language while C is not (C's big brother C++ is though). C simply executes code line by line with its variables defined in the main body of the program or within functions. Java, like other object orientated languages, is concerned with objects that hold their own variables and functions. For example, if you want to draw 3 squares on your screen, each of a different colour, in C you would define variables like SquRedLength, SquRedHeight, squRedColour, and the same for the other colour squares. Nine separate variables need to be coded and accessed by name. In Java you would simply define an object 'square' and then create three square objects. This is a much more powerful approach (imagine if you wanted 10,000 squares!).
Differences Between Java, C And C++This article aims to set out some of the differences between C, C++ and Java. What it does not aim to do is conclude that one language is always the best one to use. Language choice depends upon a range of factors including field of application (operating systems, desktop software, web applications etc), what programming paradigm suits the application (OOP, procedural, etc), the target platform and available programmer expertise. What follows should help you decide where it might be suitable to use C, C++ or Java.