Why interface concept has been introduced in java?
An interface is a prototype for a class. The class may contains non-implemented method as well as no member variables (i.e. no variable declaration). The syntax for creating interfaces is :-
interface interface_name
{
//statements
}
The syntex for implementing interfaces using "implements" keyword is :-
class class_name implements interface_name
{
//statements
}
What is meant by the data type of a variable in c plus plus?
The built-in (fundamental) data types are int, char, bool, float, double and pointer. All other integral types are either modified types or aliases (typedefs). User-defined types (including those provided by the standard library) are not considered part of the language.
What is instantiating in java?
To instantiate is to create a new "instance" of an "object" in object-oriented programming. For example, say you create an Object by defining a class called Square: (note: this is C++ but the principles are the same)
class Square{
private:
int length, width;
public:
getArea(){return length*width);
};
The above class is an Object. When you create this object, that is called an "instance" of the object:
int main()
{
Square x = new Square; // x is an "instance" of the Square "object"
Square y = new Square; // y is a separate "instance" of the Square "object"
return 0;
}
the errors arriving during the execution of a program when there is a mistake of the programmer in applying the correct mathematical logic
eg: int a= 5;
int b=0;
System.out.print(a/b);
System.out.print("correct answer");
in this eg. a runtime error will be shown and to remove it we can use try catch block
// made by vijay NITJ
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<math.h>
int precedence(char);
void main()
{
char q[20];
char p[20];
char stack[20];
int tp=-1,ts=0;
stack[0]='(';
cout<<stack;
int i=0, f=1;
cout<<"enter the prefix expression ";
gets(q);
int l=strlen(q);
q[l]=')';
while(ts!=-1)
{
if(q[i]>=47 && q[i]<=58 q[i]<=65 && q[i]<=90 q[i]<=97 && q[i]>=122)
{
p[++tp]=q[i];
}
else if(q[i]=='(')
stack[++ts]=q[i];
else if(q[i]=='+' q[i]=='-' q[i]=='*' q[i]=='/')
{
if(stack[ts]=='(')
stack[++ts]=q[i];
else
{
while(stack[ts]!='(')
{
int p1=precedence(q[i]);
int p2=precedence(stack[ts]);
if(p2>=p1)
p[++tp]=stack[ts--];
else
{
f=0;
break;
}
}
if(f==0)
stack[++ts]=q[i];
}
}
else if(q[i]==')')
{
while(stack[ts]!='(')
{
p[++tp]=stack[ts--];
}
ts--;
}
i++;
}
for(int j=0; j<=tp;j++)
{
cout<<p[j];
}
//precedence program
int precedence(char a)
{
if(a=='+' a=='-')
return 1;
else if(a=='*' a=='/')
return 2;
}
Which statements are nedded to control loop?
A For loop requires 3 parameters:
for( int i = 0; i < 10; ++i )
{
}
So, the first parameter - int i = 0 - shows the integer that you will be using to cycle with. This variable sometimes corresponds with what you're cycling through, so if you're using an array, array notation dictates that you can access the array with integers.
The second parameter - i < 10 - says that if the i variable is less than 10, do the for loop.
The third parameter - ++i - shows by how many you want to increment or decrement the variable by. This means that the for loop I have provided will run 10 times. (Remember: if you start at 0 - which all arrays and vectors e.t.c will do - you need to start your For loop at 0)
What is Java Runtime used for?
A Java Runtime Environment (JRE) is the base set of data files and programs (executables) which are required to run Java Applications. Typically, this consists of a Java Virtual Machine (a virtual computer/processor which the Java program runs 'on'), the Java Libraries (definitions of objects and functionality which Java programs can utilise), and any additional supporting software.
If you have been instructed to get java so that you may use a certain website or piece of software, this means you are required to install a JRE.
The 'standard' JRE is developed by Sun Microsystems, the original developers of Java, and is available at http://java.sun.com/
Typically, each JRE version has had multiple updates since its initial release, so you will probably need to download a file called something like Java 6 update 2, or JRE 6 update 2, or even referred to via shorthand like Java 6u2.
To test which version of a JRE is installed (if any), run the command "java -version" in a command-line (Windows) or Terminal (Unix/Linux/Mac).
Other run-time implementations of Java are available under different license conditions, although most focus on the actual JVM itself, rather than completely re-implementing all of the additional tools and libraries.
The JRE is distinct from the JDK (Java Development Kit) in that the JDK contains additional software which is required only for developing Java applications - such as the Java Compiler javac, and which most users will not require.
How do you execute a package in java?
You don't execute a package; you execute a class. A package is just a grouping of classes.
You don't execute a package; you execute a class. A package is just a grouping of classes.
You don't execute a package; you execute a class. A package is just a grouping of classes.
You don't execute a package; you execute a class. A package is just a grouping of classes.
What is mean by parse in java?
It is used to convert the value of one datatype into a value of another datatype. Example- Integer.parseInt(in.readLine); It converts given value to Integer datatype.
Why path and class-path in java?
1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files.
Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.
What is the future scope of java programming?
Certainly, here's an expanded section on the future scope of Java programming with a reference to your institute, "AchieversIT":
The Future Scope of Java Programming with AchieversIT:
Java programming, often dubbed as the "king" of programming languages, has a remarkably promising future in the world of technology. As technology continues to evolve, so does the relevance and demand for Java expertise. At AchieversIT, we recognize the enduring significance of Java and are committed to equipping our students with the skills needed to excel in this dynamic landscape.
**1. Robustness and Versatility:
Java's reputation for stability, reliability, and cross-platform compatibility remains unshaken. Its ability to run on diverse devices and operating systems makes it an ideal choice for developing applications ranging from web and mobile to desktop and embedded systems. AchieversIT ensures you're well-versed in these foundational concepts, preparing you for diverse software development roles.
**2. Enterprise-Grade Applications:
Java is the backbone of many enterprise-level applications, making it a key player in the corporate world. As an AchieversIT student, you'll gain insights into building robust, scalable, and secure applications that meet the rigorous demands of modern businesses.
**3. Big Data and Data Science:
Java seamlessly integrates with big data technologies like Hadoop and Spark, enabling efficient data processing and analysis. The skills you acquire at AchieversIT will empower you to contribute to the booming field of data science and analytics.
**4. Cloud Computing:
Java powers numerous cloud-based applications and services. As the cloud computing landscape expands, so does the demand for professionals skilled in developing cloud-native applications. Our comprehensive training ensures you're well-prepared for this cloud-driven future.
**5. Android App Development:
Java remains the primary programming language for Android app development. With AchieversIT, you'll master the art of creating captivating and functional Android applications, positioning you for success in the ever-growing mobile app market.
**6. Internet of Things (IoT):
As IoT devices become more prevalent, Java's role in creating embedded software for these devices becomes increasingly vital. Our IoT-focused training equips you to contribute to this exciting and rapidly evolving domain.
**7. Career Opportunities:
With Java's continued dominance in various domains, your proficiency in this language will open doors to a wide array of career opportunities. AchieversIT ensures you're not only proficient in Java but also well-prepared to thrive in your chosen career path.
In conclusion, the future of Java programming is remarkably bright and diverse. With AchieversIT's comprehensive training and support, you'll be well-prepared to harness the endless possibilities that Java offers. Join us in shaping the future of technology through Java expertise. Enroll at AchieversIT today and embark on a journey toward a fulfilling and successful career in the world of Java programming.
Basically they do the same: converting from one level of language into another. A compiler converts high level language (programming language like java) into machine-language. That is language a computer understands.
An interpreter converts high level language into an intermediate level. When a program is exectuted, that intermediate level is reconverted to machine language.
Is the loop control variable initialized after entering entering the loop?
Yes. All variables must be initialised (assigned a value) before they are first used. In a loop, a control variable (if specified) is "used" by the control statement. Using an uninitialised variable results in undefined behaviour, hence compilers will warn against this by default.
How do you declare symbolic constants in Java?
Symbolic constants are named constants
like :
final double PI = 3.14 ;
They are constants because of the 'final' keywords, so they canNOT be reassigned a new value after being declared as final
And they are symbolic , because they have a name
A NON symbolic constant is like the value of '2' in expression
int foo = 2 * 3
Synchronizaion is the process by which only one Thread can access an object at a time,until and unless thread releases it's lock no other thread can acess the object. there are two forms of syncronization method and statement.
to make a method synchronized just add the keyword synchronized to the signature ie: public synchronized void increment() {
c++;
}
to create syncrhonized statements are like this:
synchronized(this) {
lastName = name;
nameCount++;
}
note: constructors can not be syncronized
Can you call an abstract method from a non abstract method in java?
We can't call (i.e, execute) an abstract method in java because these methods don't contain any code to execute!
In some special cases like when an abstract method is overridden in a subclass, and when we are using super class reference variable( which is referring that subclass object), it appears that we are calling abstract method in super class. But actually the code in the subclass method is being executed.
Example:
abstract class SuperClass{
abstract void show(); //abstract method in super class
}
class SubClass extends SuperClass{
void show(){ //show() of SuperClass overridden in SubClass
System.out.println("SubClass Method");
}
}
class Example{
public static void main(String... args){
SuperClass sup=new SubClass();
sup.show(); //SubClass show() will be executed !!!
}
}
The String array args refers to the arguments that the program may require before starting. In many cases you may want the program to take some values as input for processing. this string array is for that purpose.
What does private int mean in java?
The private keyword denotes that the field or method is hidden from view of any other class.
class MyClass {
private int n; // n cannot be accessed by any class except MyClass
private void doSomething(){} // doSomething cannot be accessed by any class except MyClass
}
What is the class of a barnacle?
Barnacles are shrimp-like arthropods that swim free when young then glue themselves to some hard surface and spend the rest of their life kicking food into their mouths with their feather-like legs.
What is different between inheritance and encapsulation?
wrapping up of data and function into a single unit is called encapsulation where polymorphism is the ability to take more than one form
What function initializes variables in a class?
you have to initialize it into the "Constructor" which is a function without dataType and it's name is the same with the class name
EX:-
class Exforsys
{
private:
int a,b;
public:
Exforsys();
...
};
Exforsys :: Exforsys()
{
a=0;
b=0;
}
the EX from : http://www.exforsys.com/tutorials/c-plus-plus/class-constructors-and-destructors-in-c.html
I recommend this link for You Under the title "Constructors and destructors" :
http://www.cplusplus.com/doc/tutorial/classes/
You can also See : http://www.win.tue.nl/~maubach/university/education/online-references/cpp/swartz/notescpp/oop-condestructors/constructors.html
A destructor is exactly the opposite... it gives the object a chance to grab any objects that need to be free'd prior to being freed itself. If care is not taken to "free" objects that have been used but are no longer required this is what is sometimes called a "memory leak". The memory allocated to that object is lost for use. It cannot be re-used for anything else because it is considered "still allocated" even though it is not in use. Generally, this type of program runs out of memory if it is something that runs for days without being restarted.
smartlink4u@hotmail.com
Usama Ikhlaq
If you are getting that error, it means that either Java is not installed, or is not in your path.
If Java is not installed, go to http://www.java.com to install the most recent version of the JRE.
If you're sure you have already installed Java ensure the Java executable is in your system's path. You can do this by first finding the directory it is installed in. For example, mine is installed in C:\Program Files\Java\jre6. The executables are located in the bin directory.
In order to set your path (Assuming Windows Vista), go to Start -> Control Panel -> System, then click on the 'Advanced System Settings' link on the left, then the 'Environment Variables' button. In the lower section (Labeled 'System Variables'), scroll through and find the item labeled 'Path' and double click it. In the field labeled 'Variable value' go to the end and add a semicolon (;), and then the path your installation of Java is located. Using the example I gave above, I would have added ;C:\Program Files\Java\jre6\bin to the end of the line.
The procedure for 64-bit Windows Vista or Windows 7 is the same, except the text you will add to the Path variable is ";C:\Program Files (x86)\Java\jre6\bin". Notice there is still a semi-colon at the beginning of the line.
Once you have done this, you will need to close and reopen the command prompt if it is already open, and you should be able to run java without getting this error message.