Can userdefined exception have two methods in it?
Yes a user defined exception can have any number of methods in it.
A user defined exception is nothing but a Java class created for a specific purpose. Just like ordinary Java classes, you can have any number of methods in it...
The routing protocol also specifies how routers in a network share information with each other and report changes. The routing protocol enables a network to make dynamic adjustments to its conditions, so routing decisions do not have to be predetermined and static.
How is it possible that the same Java program can run on different platforms?
Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform. Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform.
From which website can you learn JAVA for free?
There is an enormous amount of free information available for this language. A search in Google for the keywords Java tutorials gives over 15 million hits. The first hit - java.sun.com/docs/books/tutorial/ - is quite good, at least for a start. Note that Sun is the creator of the Java language. But I found that it advances too quickly on some topics, so (after going through the first, introductory, chapters), you may want to search for additional sources of information.
Be sure to:
Be sure to:
Be sure to:
Be sure to:
How do you get the proper division in java?
import java.io.*;
public class ProperDivision
{
public static void main (String [] args) throws IOException
{
BufferedReader value = new BufferedReader (new InputStreamReader(System.in));
int n;
int sum;
int divisor;
String input;
System.out.print("Enter an integer:");
n = Integer.parseInt(value.readLine());
for(n=1;n==n;n++);
System.out.println("The proper divisor of "+ n + " are");
}
}
SILAR - SUCCESSIVE IONIC LAYER ABSORPTION AND REACTION is a low temperature and solution based process that can deposit atomic layers one layer at a time. The traditional SILAR cycle for a substrate is
Dip in Cation precursor solution
Rinse with distilled water
Dip in Anion solution
Rinse with distilled water
To break something down with specific details.Like if you want ice cream you have to specify what kind of ice cream you would like.
Write a program to create a thread by extending the thread class?
import java.util.Random;
class ExampleThread extends Thread {
private static final Random rnd = new Random();
public ExampleThread(String str) {
super(str);
}
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i + " " + getName());
try {
sleep(rnd.nextInt(1000));
} catch (InterruptedException e) {}
}
System.out.println("Thread is: " + getName());
}
}
How to write java program for FLAMES game?
for (int i = 0;i < nme.length() ;i++ ) { n[i] = nme.charAt(i); } for (int j=0;j < lnme.length() ;j++ ) { l[j] = lnme.charAt(j); } for (int i = 0;i < nme.length() ;i++ ) { for (int j=0;j < lnme.length() ;j++ ){ if(n[i] == l[j]){ n[i] = ' '; l[j]=' '; } } } int C = 0; for (int i = 0;i < nme.length() ;i++ ) { if(n[i] != ' ' ){ C ++; } } for (int j=0;j < lnme.length() ;j++ ) { if(l[j] != ' ' ){ C ++; } }
refer this site for full coding: http://shamjeet.blogspot.in/p/java-se.html#c
An equivalence relation ~ on A partitions into pairwise disjoint subsets called equivalence classes so that 1. Within each class, every pair relates 2. Between classes there is no relation i.e. [x] = {a (element) A | a~x} and given two equivalence classes [a] and [b], either [a] = [b] or [a] intersect [b] = the empty set
An array is when you store several data items with a single name. You only use a number to distinguish the individual items. Or two or more numbers, if you use a multidimensional array.
An array is when you store several data items with a single name. You only use a number to distinguish the individual items. Or two or more numbers, if you use a multidimensional array.
An array is when you store several data items with a single name. You only use a number to distinguish the individual items. Or two or more numbers, if you use a multidimensional array.
An array is when you store several data items with a single name. You only use a number to distinguish the individual items. Or two or more numbers, if you use a multidimensional array.
In java difference between classes and object in tabluar form?
A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.
A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.
A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.
A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.
I dont know how to generate the nos. randomly.I think it should follow some logic.So the following prog is made upon the inputs given by a user.
#include
#include
void main()
{ int a[5][5],i,j,s;
printf("\nEnter elements of the 5X5 matrics:\n");
for(i=0;i<5;i++)
{ for(j=0;j<5;j++)
{ scanf("%d",&a[i][j]);
if(a[i][j]<0 a[i][j]>100)
{ printf("\nThe no. should be between 1 & 100\nEnter Again:");
scanf("%d",&a[i][j]);
}
}
}
printf("\nThe given matrix is:\n");
for(i=0;i<5;i++)
{ for(j=0;j<5;j++)
printf("%d",a[i][j]);
printtf("\n");
}
printf("\nThe sum of each row:");
for(i=0;i<5;i++)
{ for(j=0;j<5;j++)
s+=a[i][j];
printf("%d->%d\n",i+1,s);
}
getch();
}
Hope this would help you.
What are the four major stages of compilation in programming?
This actually varies based upon the language as some have less than 4 or more than 4. However I believe you're looking for:
-Preprocessor
-Compile
-Assembler
-Linker
When variables are declared in the body of a method they are know as what?
Local Variables
There are two types of variables based on the location of declaration
1. Instance Variables- Declared inside a class, but outside of any method's body.
2. Local Variables- Declared inside a method's body inside a class.
How do you sort the given contents of an array?
You would sort the given elements of an array by a bubble sort or heap sort code!!
What is the base class for all swing components?
The JComponent class of the javax.swing package serves as the base class.
for i = 0 to 8
{
print i, i^2, i^3
}
Why method overloading is not possible by return type method?
A method can be used, and the return type discarded. For example, for a method that returns, say, an integer, instead of calling it like this:
int x;
x = MyMethod(1, 2);
You can also call it like this:
MyMethod(1, 2);
That is, without using the return value. In such a case, if you were to have different methods with the same parameters but different return values, the compiler wouldn't know which version of the method to use.
What is string and how they are declared?
Strings are user defined data types which can store any type of data assigned to it with in double quotes(" "). They don't have a limit to their storage capacity like other data types,viz.,int byte long.
What happens to child thread when you delete main thread during run-time?
In Java, if the main thread somehow exits then all other threads will stop executing. This generally does not happen, as the main thread will wait for all child threads to terminate before the main thread itself finishes. Interrupting this process is hard to do short of an un-handled exception or a call to System.exit.
If the child thread is also a daemon thread, then the child thread will continue to execute. If the child thread is a normal thread then, the moment System.exit is called, the child thread also terminates
If you call the join() method from the child thread, then the main thread will wait until the child is over before executing the System.exit
How super class variable can be used to refer the sub class object?
The super variable is not a reference to a subclass. It is a reference to the superclass.
class MyClass {
void printType() {
System.out.println("This is a MyClass");
}
// MySubClass is a subclass of MyClass. Within this class, the super keyword
// refers to MyClass.
static class MySubClass extends MyClass {
void printType() {
// Tell Java we also want to call the printType method of the super class
super.printType();
System.out.println("This is a MySubClass");
}
}
}