Need help
Hello...
I need some help
I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name..
for example..
i have a method name() which contains 1 string value suppos "s"
and i hav 1 arraylist named temp
arraylist temp=new arraylist
so i want that wen i call method name() the arraylist name"temp" shud b replaced by string value"s"
so my new arrayname will b the string passed in method....
View Answers
June 7, 2011 at 4:56 PM
Hi Prasant
The code you needed is given below :
import java.util.*;
class ArrayListTemp {
ArrayList ALST = new ArrayList();
ArrayList NLST = new ArrayList();
ArrayListTemp() {
ALST.add("One");
ALST.add("Three");
ALST.add("Two");
ALST.add("Four");
return;
}
@SuppressWarnings("unchecked")
void replace() {
NLST = ALST;
ALST = null;
System.out.println("Elements of First ArrayList are Deleted");
System.out.println("The First ArrayList Elements are : " + ALST);
System.out.println("The Second ArrayList Elements are : " + NLST);
}
}
public class ArrayListDemo {
public static void main(String[] args) {
ArrayListTemp AT = new ArrayListTemp();
AT.replace();
}
}
June 7, 2011 at 4:59 PM
The output of the above code should be like this
Elements of First ArrayList are Deleted
The First ArrayList Elements are : null
The Second ArrayList Elements are : [One, Three, Two, Four]
Ads
Related Tutorials/Questions & Answers:
Need help
Need help Hello...
I
need some
help
I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name..
for example..
i have a method name() which
Need help
Need help Hello...
I
need some
help
I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name..
for example..
i have a method name() which
Advertisements
Need help
Need help Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another drop.... This name list should get from the database. Please
help me.
By the way, I'm
Need help with this!
Need help with this! Can anyone please
help me... to a file at all at this time. Any
help would be greatly appreciated, thank you... to effectivly end the loop with out the
need to break it.
for(i=(0); i <
Need help with nested queries
Need help with nested queries Hello,
Table1 has "id", "votes" columns. Table2 has "id", "Name" column. I
need to retrieve Name and its corresponging Votes. I tried with nested queries but its confusing. Can anyone please
help
need help to create applet
need help to create applet Can u
help me..??
I get a task ...and i dont know how to make it...
So I hope that u can
help me...
Here is the task...
e) CardLayout
If u can
help me, then please
need help please
need help please Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please
help me.
By the way I'm using Access database
Need Help in Java programming
Need Help in Java programming Hello. Can someone please
help me with writing the following program
Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
need help with program
need help with program To write a program to read a set of words from a file and return the following
1)Each word in the file against its frequency
2) the frequency should be in the descending order of the frequencies
need help with program
need help with program To write a program where we can take two integer array as input,Find the missing number from array"B" has all the numbers from array"A" except one,and find the fastest way in doing
Need help on JAVA JSP
Need help on JAVA JSP Hi,
I have never worked on java and I have been given an assignment where I have to fix existing issues in the tool(created...(
need to know how I can adjust it based on the cureen system's screen resolution
Friends need a help on ruby..
Friends
need a
help on ruby.. Friends i
need a ruby script and the requirement is
When i am running a ruby script in cmd, after executing my script, a html report will be generated having my console output details. For ex
Need some help urgently
Need some
help urgently Can someone please
help me with this below question. I
need to write a class for this.
If you roll Y standard six-sided dice...
need to write a class for this where X and Y are passed as parameter. If someone
hello there i need help
hello there i
need help : i
need to do a program like this:
Automatic Teller Machine
[B] Balance
[D] Deposit
[W] Withdrawal
[
Q] Quit
select you... i am a beginner, and aside from that i am really eager to learn java please
help
Need help with console program?
Need help with console program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed).
thanks in advance.
Here is an example that repeatedly
Need Help With This Scenario
Need Help With This Scenario The bonnet of a car is opened to determine if there is anything wrong with the
engine. Firstly, the radiator water is checked. If the radiator water is below the
minimum indicator level
Need Help With This Scenario
Need Help With This Scenario The bonnet of a car is opened to determine if there is anything wrong with the
engine. Firstly, the radiator water is checked. If the radiator water is below the
minimum indicator level
Need Help on the script
Need Help on the script hello there,
My name is Femi and am a web developer using php. am working on a project. and am having some difficulties. i dont know if you can
help me out with it.
The platform am building will receive
i need a help in this please
i
need a
help in this please The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??)
and is defined as follows:
n!=n . (n-1) . (n-2) . .... . 1 (for values of n greater than or equal to 1) and
n!=1
Need help with my project
Need help with my project Uses a while loop to perform the following steps:
-Prompt the user to input two integers: firstNum and secondNum where secondNum is at least 10 greater than firstNum, both numbers are positive integers
need help...................please
need help...................please I have a problem in my JSP Coding. How to retrive value from database in to text field when user select one value... on this area. Please
help me.
By the way, I'm using access Database and JSP coding
I have need to help
I have
need to help Write a program that, for four points A, B, C and P, draws a triangle formed by ABC
and a small cross showing the position of P; and displays a line of text indicating which of
the following three cases
need someone to do/help with code
need someone to do/
help with code i
need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please
help did a code 500 times cant
Need urgent help with C++ errors!
Need urgent
help with C++ errors! hi,
i'm new to C++ programming... don't know what to do.
Please
help!!
#include<iostream.h>
void main...
help
PLZ Need some help JAVA...HELP !!
PLZ
Need some
help JAVA...
HELP !! Create a class names Purchase Each purchase contains an invoice number, amount of sale and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set
Need help in constructing bubble sort
Need help in constructing bubble sort using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated
i need help plz .... Quickly
i
need help plz .... Quickly how can i count how many numbers enterd by the user so the output would be like this
Total number of Scores = ....
this is my code :-
import java.util.Scanner;
public class SCORES
{
public
i need help to solve this problem
i
need help to solve this problem Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input and prints them in reverse order. and
Show step by step what queue will look like
hi need help with C++ programming!
hi
need help with C++ programming! how do i :
b. Store numbers / characters into the file (output)
c. Retrieve numbers / characters from the file (input
thanks!
b)
#include <iostream>
#include <
Java Programming Need Help ASAP
Java Programming
Need Help ASAP You are required to develop..., maths mark, communications mark. You will then
need accessor and mutator methods... class that creates an array of Students and handles it. You will
need
Need help writing a console program
Need help writing a console program I
need help cant seems to figure it out!
Write a program that consists of three classes. The first class will be the actual program.
The second class will simply convert a string to lower