473,218 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

Whether I can use one file for all import things?

7 Nibble
demo1.java:
Expand|Select|Wrap|Line Numbers
  1. import a;
  2. import b;
  3. import c;
  4. import d;
  5.  
demo2.java:
Expand|Select|Wrap|Line Numbers
  1. import b;
  2. import c;
  3. import d;
  4. import e;
  5. import f;
  6.  
I have an idea, I just use one import_file file for doing the import things, then demo1.java and demo2.java just need import the import_file once, it can make our java code more brevity.

just like this:

import_file
Expand|Select|Wrap|Line Numbers
  1. import a;
  2. import b;
  3. import c;
  4. import d;
  5. import e;
  6. import f;
demo1.java

Expand|Select|Wrap|Line Numbers
  1. import import_file
demo2.java

Expand|Select|Wrap|Line Numbers
  1. import import_file
I want to know does my idea work? are there any drawbacks?
Jan 6 '23 #1

✓ answered by BloomS

This idea would work and can make your Java code more succinct. There are no drawbacks to this approach, as long as all the imports that are required are present in the import_file. It may be helpful to organize the imports in the import_file alphabetically or by category to make it easier to find the needed imports.

4 6835
NeoPa
32,554 Expert Mod 16PB
Hi Mark.

I'm not sure if you noticed, but you posted this into the Lounge by mistake. It's obviously very important that questions be posted in the appropriate forum if you want helpful answers and to avoid irritating those in the Lounge.

I've assumed it's a Java question, rather than JavaScript, so let me know if I have that wrong.
Jan 7 '23 #2
BloomS
8 Nibble
This idea would work and can make your Java code more succinct. There are no drawbacks to this approach, as long as all the imports that are required are present in the import_file. It may be helpful to organize the imports in the import_file alphabetically or by category to make it easier to find the needed imports.
Jan 11 '23 #3
markleo
7 Nibble
Thanks, it should be under java category.
Jan 11 '23 #4
NeoPa
32,554 Expert Mod 16PB
Excellent Mark.

And you've also got, what looks to me like, a very helpful answer already.

I took the liberty of marking it as BestAnswer as it seems to deal with your question appropriately (from my non-java expert perspective at least).
Jan 12 '23 #5

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

Similar topics

2
by: OvErboRed | last post by:
Hi, I'm trying to determine whether a given URL exists. I'm new to Python but I think that urllib is the tool for the job. However, if I give it a non-existent file, it simply returns the 404 page....
2
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
11
by: Dale | last post by:
How to recognize whether file has XML format or not? Here is the code segment: XmlDocument* pDomDocument = new XmlDocument(); try { pDomDocument->Load(strFileName ) ; } catch(Exception* e) {
5
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can...
7
by: Joe Fallon | last post by:
I am importing a delimited ASCII text file into a dataset using OLEDB. I set up the connection and dataadapter and then fill the dataset. It works - sort of. It turns out that some of my data is...
10
by: Avi | last post by:
Hi I need to read in a large set of text files (9GB+ each) into a database table based on fixed width lengths. There are several ways to complete this, but I am wondering if anyone has...
1
by: Child of His | last post by:
I have been through every trick I know, or has been suggested. I have a one to two million line fixed field database in text format. I want to bring it into Access 97. When I use the external...
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
2
by: SDEBEUL | last post by:
Hi, I have a complex text file import issue. The first 13 lines of the file need to be skipped. Then each of the next 2 lines need to be combined in one record. the format of one record...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.