Solved

New to Java programming

Posted on 2003-11-01
5
231 Views
Last Modified: 2010-03-31
Hi,

I am a new java programmer, i would like to ask the following questions:

1. Say if i wanted to use x.class for some of its methods, how do i let my program "know" that i want to use methods from x.class?

2. Could anyone recommend a good Java IDE?

I would greatly appreciate any help on the above. Thanks.
Samsungfanatic.
0
Comment
Question by:samsungfanatic
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 40 total points
ID: 9664346
If you have a class called MyClass, you create an "instance" of it (an object) like this:

MyClass myObject = new MyClass();

If the MyClass has a method called "getName()", you tell the object you created to get the name like this:

String theName = myObject.getName();


The class would look like this:

public class MyClass
{
    private String name;

    public MyClass()
    {
        name = "example";
    }

    public String getName()
    {
        return (name);
    }
}

Java IDE's.  Try:

http://www.netbeans.org

http://www.eclipse.org

Good luck ;-)
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9664350
Next level of complexity ;-)

Classes are usually created inside "packages".  A package is a logical collection of related classes.  eg. The package java.awt contains all the main abstract windowing toolkit classes like Frames, Windows, Buttons etc.

If you want your class to be able to access a Button, you "import" the class into your .java file:

import java.awt.Button;

public class MyClass2
{
    private Button myButton;
    .
    .
}
0
 
LVL 3

Expert Comment

by:InNoCenT_Ch1ld
ID: 9669716
For your IDE question:

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20777711.html

however, i suggest that you use notepad since you are new to Java, this will help you to learn this language.. personally, i've only try JBuilder and i find it quite good, but i'm still prefer to write in notepad ;p

-Child-
0
 
LVL 3

Expert Comment

by:InNoCenT_Ch1ld
ID: 9669724
Afterall, jimmack has already answer your question clearly and i think you should accept his comment as answer :p

Good day
-Child-
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9670059
Thanx ;-)
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question