![]() |
| | #1 |
| Registered User Join Date: Mar 2003 Location: Louisiana
Posts: 926
| Java question |
| linuxdude is offline | |
| | #2 | |
| Webhead Join Date: Jul 2009
Posts: 278
| Quote:
| |
| Spidey is offline | |
| | #3 |
| Guest Join Date: Aug 2001
Posts: 5,034
| >> I have a particularly bad time with java forums You too, eh? >> I created some functions that I want to use. However, it isn't object oriented and java forces me to put them in a class. So, like the Math class, I made it static. However, static proliferates and is everywhere in my code. I was wondering if there is a better way to do this without shoving all the methods in a class and then making everything static. Java seems to force object orientedness down your throat arg! Unfortunately, no. Java doesn't provide a facility for "importing" a namespace, so you're basically stuck with using the fully qualified name (short of writing a wrapper function, of course). |
| Sebastiani is offline | |
| | #4 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,783
| Java is made to be an OOP language, so it only offers this paradigm AFAIK, unfortunately. If you wanted more choice, you could try C++.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #5 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| I don't think he has a choice in the language here. Java 5 and up offers import static to reduce the typing necessary. Code: import static com.example.Utility.*; I'm not sure what you mean by "static proliferates". Also, programming questions about misc. languages belong in the tech forum. I'm moving this thread.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #6 |
| Woof, woof! Join Date: Mar 2007 Location: Australia
Posts: 3,295
| No one said you _have_ to use OOP. You can have one class, which is hardly OOP if it doesn't interact with other classes. And use a pre-processor to include other files and go procedural :-) |
| zacs7 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mats, the java answers | Jaqui | General Discussions | 1 | 04-22-2008 02:12 AM |
| Java vs C to make an OS | WOP | Tech Board | 59 | 05-27-2007 03:56 AM |
| Windows GDI vs. Java Graphics | Perspective | Windows Programming | 7 | 05-07-2007 10:05 AM |
| How to use Java with C++ | Arrow Mk 84 | C++ Programming | 2 | 02-27-2003 04:12 PM |
| A question for .. java! | McAuriel | A Brief History of Cprogramming.com | 4 | 12-01-2002 11:16 AM |