473,396 Members | 2,147 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,396 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 7018
NeoPa
32,556 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,556 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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.