473,661 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return arraylist error

oll3i
679 Contributor
Expand|Select|Wrap|Line Numbers
  1. public ArrayList<String> wyswietlHistorieRachunku(String numer_konta) {       
  2.  
  3.     try { 
  4.         BufferedReader br = new BufferedReader(new FileReader("konta//"+numer_konta+".txt"));
  5.         ArrayList<String> historia = new ArrayList<String>();
  6.         String strLine = br.readLine();
  7.  
  8.         while((strLine = br.readLine()) != null){   
  9.               historia.add(strLine); 
  10.  
  11.              }  
  12.  
  13.       br.close();
  14.       }catch (FileNotFoundException e) {
  15.             System.err.println("Nie ma takiego konta(File not found!)");
  16.       }catch (IOException e) {
  17.               System.err.println(e);
  18.       }catch (Exception ex)  {
  19.       ex.printStackTrace();  }     
  20.        }
  21.    return historia;
  22. }
I want to return an arraylist historia
why eclipse says syntax error on token return ,invalid type ?
Apr 14 '07 #1
3 9788
JosAH
11,448 Recognized Expert MVP
I want to return an arraylist historia
why eclipse says syntax error on token return ,invalid type ?
Eclipse doesn't say that; it says something like: 'historia: symbol not found".
You've defined that list in the try { ... } block and it doesn't exist outside of
that block. Define the historia variable above that try { ... } block in an outer
local scope.

kind regards,

Jos
Apr 14 '07 #2
oll3i
679 Contributor
I did what u suggested and still eclipse highlights return as an error
Apr 14 '07 #3
oll3i
679 Contributor
okey i solved it thank you
Apr 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
1998
by: Stefan Slapeta | last post by:
Hi, this code does not compile in C#: class base_class {} class derived_class : base_class {} class A { public virtual base_class f()
9
20586
by: Ryan Taylor | last post by:
Hello. I am trying to overload a method so that I have four possible working copies. The only difference between the four methods is what to search by and in what manner to return the results. So I have the following. public static ArrayList GetRoles(int userID) public static ArrayList GetRoles(string username) public static string GetRoles(int userID) // Error 1 public static string GetRoles(string username) // Error 2
12
4120
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport) {
3
10270
by: RJN | last post by:
Hi I have a user defined data type which implements IComparable interface and has an implementation for the CompareTo method. Public Class MyDataType Implements IComparable --Private members --Public properties
25
2555
by: guy | last post by:
i have inherited the following migrated vb6 code (vb2005) but i DONT get the "not all paths return a value" squiggly - is this a 'feature' of on error goto? Private Function CreateFolder(ByVal sFileName As String) As Boolean On Error GoTo Errors 'Create it if necessary If Directory.Exists(sFileName) = False Then
0
2481
by: jeytu | last post by:
Hi all, I'm a newbie with .net. I have created a web method that would return a class. The definition of the class is <Serializable()> Public Class Response Dim l_status As Boolean Dim l_Message As New ArrayList Public Property Status() As Boolean Get Status = l_status End Get
22
4016
by: semedao | last post by:
Hi , I am using asyc sockets p2p connection between 2 clients. when I debug step by step the both sides , i'ts work ok. when I run it , in somepoint (same location in the code) when I want to receive 5 bytes buffer , I call the BeginReceive and then wait on AsyncWaitHandle.WaitOne() but it is signald imidiatly , and the next call to EndReceive return zero bytes length , also the buffer is empty. here is the code: public static byte...
3
15005
by: BombDrop | last post by:
Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile Error 29 Cannot implicitly convert type 'System.Collections.Generic.List<Prsym.ComboPopulation.ComboInfo>' to 'System.Collections.Generic.List<T> '
3
2270
by: sony.m.2007 | last post by:
Hi, I’m new to ASP.NET I have written a function with a return value. If the arguments to the functions are invalid means I’m giving exit(0) Else means do some process and return a value. When I compile the above code, it throws error and asked for a return value in the IF part Error 1 : not all code paths return a value Example Code(just to describe)
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.