Is it possible to get a reference to this from within a Java inner class?
i.e.
Class outer {
void aMethod() {
NewClass newClass = new NewClass() {
void bMethod() {
// How to I get access to "this" (pointing to outer) from here?
}
};
}
}
From what I have gathered, I want to force a class to use particular private fields (and methods) I need an abstract class because an interface only declares public/static/final fields and methods. Correct??
I just started my first big java project and want to make sure I'm not going to hurt myself later :)
In my java application i am having latitude information in this format 28"41'44.13597 .
My need is to convert the same information into 28.705450.
Please help through code or any references
Thanks in advance
how to implement social drm in java?
how could i insert 'personal data' inside an e-book (.pdf or epub) automatically?
i think in an software interface where consumer could insert his personal data and the system generates an e-book (locked) with these data...
how could i implement this? tips?
I have Java Applet(J2EE), I want to make it accessible only to a certain set of users,by authenticating them using username and password.What is the the best way of doing this?
Consider following SWT code example:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co
How can I separate the inline defined class?
Thread thread = new Thread() {
public void run() {
...
}
};
I want to define a separate class which updates the table just like it does here. How do I pass the list back to the table? Example code?
Please advise me the difference between two ways of declaration of java constructor
public class A{
private static A instance = new A();
public static A getInstance() { return instance;
}
public static void main(String[] args) {
A a= A.getInstance();
}
}
AND
public class B{
public B(){};
public static void main(String[] args) {
B b= new B();
}
}
Thanks
Hello,
I'm writing a Java ME app and i need the label for the text field to be right aligned..
I've tried setting the layout of the TextField to Item.RIGHT but it doesn't seem to affect anything when running on my test phone (Nokia E71).
The text inside the TextField is right aligned and Lists and such items are desplayed correctly (RTL aligned) but the TextField label isn't.
Any ideas?
Thanks.
Hi there!
I was reading this C# article about the usage of properties and methods. It points out why and when to use properties or methods.
Properties are meant to be used like
fields, meaning that properties should
not be computationally complex or
produce side effects
I was asking myself how you could express this difference in Java, where you only use getters for the retrieval of data.
What is your opinion?
I use next code to print current time
Calendar cal = Calendar.getInstance();
System.out.println(cal.getTime());
I have Windows XP sp3 istalled. Current time in system tray is 14:30. But this code return 13:30
Why returned time is wrong?
What function does the "^" operator serve in Java?
When I try this:
int a = 5^n;
...it gives me:
for n = 5, returns 0
for n = 4, returns 1
for n = 6, returns 3
...so I guess it doesn't indicate exponentiation. But what is it then?
Hi,
I have a java web application .
Currently the application is installed in a cli mode [on windows/linux /solaris] by running sh or cmd scripts.
I would like to create a GUI for the App installation so that user can edit info in gui for the installation.
Any pointers/Best practices for developing gui would be helpful.
thank you
During navigation of Method class I came across the function isBridge(), javadoc of which says, that its true only if java spec declares the method as true.
Please help me understand what this is used for ? Can a custom class declare its method as a bridge if required ?
What is the best was to retrieve a file from a server using SFTP (as opposed to FTPS) using Java?
I'll leave the particular definition of best up to you but in my mind it should include free :)
Generally, how does a java applet manipulate user data? Take for instance "shopping carts" on shopping websites - after a user enters the data, is the data then preloaded each time a user accesses a website? Or is the data retrieved as the user is on the page?
Thinking that the answer to this is pretty obvious but here it goes:
When I am working on a small project for school (in java) I "compile" it.
On my coop we are using ant to "build" our project.
I think that compiling is a subset of building. Is this correct? What is the difference between building and compiling?
if you wanna code a desktop application in java for windows, mac and linux, will the code be the same for all of them?
and you just change the GUI so that the Windows application will be more Windows-like and so on?
how does it work without digging into details?
Hi all, I need to calculate for grouping objects according to their size. I got k-means algorithms in java which calculate mostly for classifying according to their two or more features and the results are not satisfy for me.I only want to calculate for grouping objects based on one feature.Pseudocode or code would be helpful, too. Thanks u all for helping.
Hi
I have a java web application running on windows currently. I may host it in future in a Linux Server.
My application allows people to upload data. I want to display the data they have uploaded in an excel file and render it in a portion of my webpage.
How do I go about this ?
Can anyone recommend a tutorial on how to write a Java Servlet which connects to MS SQL server and manages data?
I'm trying to write something which pulls products out of one database and inserts them into a stored procedure located on another database.
Thanks in advance.