|
You have not added any actual code to this to do anything. I suggest you work through this tutorial[^].
|
|
|
|
|
Sir ... I dont really have Idea .. Is it possible to do a calendar in applet ? . just a simple calendar ? ..
|
|
|
|
|
mobi35 wrote: I dont really have Idea Then go and work through the tutorial that I gave you a link for.
|
|
|
|
|
i appreciate ur knowledge pa...
my suggestion is use browser code or (html) code to invoke applet into browser..try it..my dear friend...
|
|
|
|
|
some one please tell me what is the problem
here is the code
public class sortm {
public static void main(String args[])
{
int a[]={5,3,7,2,8};
int b[]={1,9,4,8,10};
int i=1;
int j=1;
int t=0;
int s=0;
for( i=1;i<=5;i++)
{
if(a[i]>a[i+1])
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
for( i=1;i<=5;i++){
System.out.println(a[i]);
}
for(j=0;j<=5;j++)
{
if(b[j]>b[j+1])
s=b[j];
b[j]=b[j+1];
b[j+1]=s;
}
for(j=0;j<=5;j++)
{
System.out.println(b[j]);
}
}
}
and this what running say :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at sortm.main(sortm.java:14)
|
|
|
|
|
in the above code you stored array with five elements so yor index range from 0 to 4
you mention i=1 and maxmium is 5
so for iterations i become 5 at that time it will give arrayoutbound exception
you can just change
for( i=1;i<5;i++)
{
if(a[i]>a[i+1])
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
it will execute
|
|
|
|
|
sorry but you solution didnt work,
there is problem in in this statement a[i]>a[i+1] ,when i be 5 ,it is in a[5]>a[6], so compiler search for a[6] and dont found,so here gave me the problem ,and by the way what is a[i]>a[i+1] i didnt get it
thank you
modified 7-Feb-13 14:40pm.
|
|
|
|
|
OmarSH wrote: some one please tell me what is the problem
Your arrays have indexes from 0 to 4. So 0, 1, 2, 3, 4 are the ONLY valid values.
Print out 'i' and print out 'i+1' BEFORE you use it as an array index. If either of those are greater than 4 then it is a bug.
Print out 'j' and print out 'j+1' BEFORE you use it as an array index. If either of those are greater than 4 then it is a bug.
|
|
|
|
|
iknow that but i want to sort array as the code show but compiler when a[i] reach the final one a[4] it compare it with a[5] which it is not exist , i want to it stop compare when it reach the final index is there any code that could help me???
|
|
|
|
|
OmarSH wrote: i want to it stop compare when it reach the final index Then check the value of the index before the compare. Or change your for statement so it counts from 0 to 3, then when i is equal to 3, i+1 will evaluate to 4 and still be a valid index.
|
|
|
|
|
the arrays index no start with zero, and you enter here 5 element in array, so the last elent index no is 4
and you take loop upto 5 index no hense it raised error array index out of bound
int a[]={1,2,3,4,5];
for(inti=0;i<5;i++)
System.out.println(a[i]);
or
for(int i=0;i<=4;i++)
or
for(int i=0;i<a.Length;i++)
|
|
|
|
|
please am writing project about THE DESIGN AND IMPLEMENTATION OF STUDENT INFORMATION SYSTEM. this project must be design with java including the database
|
|
|
|
|
At the risk of repeating myself: no one here is going to write your project for you. Make an effort to do your own work.
|
|
|
|
|
please i need java code on the topic: design and implementation of student information.
|
|
|
|
|
Then please make use of Google to search for it, or sharpen your pencil and start coding.
|
|
|
|
|
Hello all,
I have been trying to generate an x509 certificate and sign it with my private key but I could not. I found some codes online but have problems not working properly. Also, most of them are deprecated.
I appreciate the help and support
|
|
|
|
|
|
Thanks Sandeep but I have tried the code in the link you posted and it has a problem. Have you tried it? if yes, I would benefit a lot if you send me the whole project including all the libraries.
Regards
|
|
|
|
|
That is not the way it works. We do not provide code. We are developers ourselves, we code for money.
What is the exception/ error? have you just c&p'd the code/followed the link at the end of the tutorial or did you actually read the tutorial?
It's not that hard to create X509 certificates.
|
|
|
|
|
Hello
Yes I did read the whole tutorial but the line that had a problem was this
certGen.setSerialNumber(new DERInteger(BigInteger.valueOf(System.currentTimeMillis())));
I only asked for a push not for a complete code.
That's simply it.
|
|
|
|
|
on what criteria we will decide whether to use map or list?
|
|
|
|
|
It depends what you want to do with the information you are processing. The List [^] is just a simple list of values, whereas a Map [^] has keys to values for fast access.
|
|
|
|
|
i have one confusion that when we declare a list as below
List lt = new Arraylist();
Then in that case what value it can store i.e same type of value or it is capable of storing any type of variables or objects.
Jishnu
|
|
|
|
|
The List can store any type of object, but it does not make sense to store different types in the same list.
|
|
|
|
|
Many things you need to know,
1) IF you store just one object, use List, if you have two object key and value use Map.
2) List is ordered, your objects will be stored in the order on which they are inserted, Map is not ordered, unless you use sorted ones.
Source: See List vs Set vs Map
|
|
|
|