Results 1 to 26 of 26

Thread: Learning java!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    karachi
    Posts
    10

    Learning java!!!

    A message was posted in this forum asking how to learn java.

    Well i do know something about java but the problem is i know far less than i require.

    There are so many java related technologies and i am learning java all by myself . Many people scare me that there is too much to cover in java world that its simply is impossible. Is it true ?

    Or got any tips??
    maryam

  2. #2
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    I too am learning java. I am reading a book called Beginning Java 2 (JDK 1.3 edition). I have read about 150 of 1200 pages. Seems to be pretty good so far although I am moving more slowly through this book than any other book I have read on any programming or scripting language.

  3. #3
    DaoK
    Guest

    hi :)

    I will learn Java at school and I will have to buy a book. I think is the best way to have a base but the best is to try and do error We learn so much with our error but of course you need a base to start. I suggest you to buy a book.

    Cya

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I think the best thing to do is learn the base of the language first. Operators and assignments. Flow control. Exception handling ect.... Learn the API. You dont have to necessarily memorize every method of every class but know what packages are use for what and just memorize some of the most common methods in some of the classes.

    Learn the concepts of OOP. For instance "A class models an abstraction by defining behaviors and properties for the objects represented by the abstraction" Understand about inheritance
    Overriding vs. Overloading. Variable shadowing. Then classes. Innerclasses, Localclasses ect......

    Get the concepts down and everything will be eaiser to learn after that.

    There is a lot to learn but it all matters what you want to do with the language. Do you want to work primarily with Databases? Do you want to program for wireless diveces? Such as the new
    (Nextell Moterola i85s phone) Maybe you want to be a game programmer. There is no doubt that there is a lot to learn but as you get further then stuff becomes more generlized into specificaly what you want to do and should focus on.

  5. #5
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    what is variable shadowing

  6. #6
    I'm guessing either something he made up to sound like an OOP expert , or using private variables with accessor functions.

  7. #7
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    There are a lot of good websites that give downloadable applets. I learned a lot by just looking at the code for those. Also, if you get a good IDE like JBuilder, it will usually have great documentation that you can help a lot.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  8. #8
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Filbert1 no offence but if you dont know what variable shadowing is then you dont understand OOP. But i think you are just kidding.

  9. #9
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I'm guessing either something he made up to sound like an OOP expert , or using private variables with accessor functions.
    I think that would be more along the lines of Encapsulation.

  10. #10
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    enlighten me as to what it means please

  11. #11
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    A subclass cannot override variable members of the superclass but it can however shadow them, be defining variables with the same name. A subclass method can use the keyword super to access inhereted members, including shadowed variables.

  12. #12
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    ok thats what i thought it meant. is shadowing a common term?

  13. #13
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    pretty much. I guess. I only know Java which is OOP. Visual Basic
    has the ability to define classes but i never really have a need for them. I always just use standard modules(.bas) vs. class modules (.cls). How long have you been programming? And what languages do you know? which ones do you like?

  14. #14
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    only vb and php and now java

  15. #15
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    the reason why i want to learn java is mainly servlets and jsp but i figure i might as well learn to program some windowed apps

  16. #16
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    yeah, wait till you learn javabeans, their awesome

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  17. #17
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    is that the same as EJB?

  18. #18
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Is a servlet the same as a javabean? I have no clue. I really havent gotten that into the server aspect of Java. Im still focusing on the core language and Swing.

  19. #19
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    sorry , i meant is EJB the same as a javabean?

  20. #20
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    does anyone post on the sun forums?

  21. #21
    New Member
    Join Date
    Aug 2001
    Location
    Bay Area CA
    Posts
    2

    Lightbulb Free Java intro class for VB developers

    I'm currently working on an intro to Java programming class that is specifically targeted at VB developers. The course takes an approach to learning Java that works for someone who knows VB (and doesn't know other strict OO languages like C++). Points out parallels and contrasts between VB and Java, etc.

    I'm developing this course for Sun, and they're holding a ~free~ Beta pilot class in Pleasanton, CA, October 8-12. The class is 5 days.

    I'd love to get some feedback from the VB community on this course. If you're interested in attending, drop me a line at [email protected].

    -Dave

  22. #22
    Originally posted by Randy_Bartels
    does anyone post on the sun forums?
    Even more frequently than they post here. And there are TONS of different forums there too. But not as many features as vBulletin, of course.

  23. #23
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Randy_Bartels......... Yeah i post there sometimes. I give all of my duke dollares away. (not really ) You will notice two kinds of people there. The ones who know there sh*# and the ones who dont know sh$!.... {{{laughing}}} no but seriously i think suns has a really good complex of forums on their site.

  24. #24
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Borland also has some great community forums.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  25. #25
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    i'm having problems understanding the following code:

    public class Point
    {
    // Create a point from its coordinates
    public Point(double xVal, double yVal)
    {
    x = xVal;
    y = yVal;
    }

    // Create a point from another point
    public Point(Point point)
    {
    x = point.x;
    y = point.y;
    }

    // Convert a point to a string
    public String toString()
    {
    return x+","+y;
    }

    // Coordinates of the point
    protected double x;
    protected double y;
    }

    public class ListPoint
    {
    // Constructor
    public ListPoint(Point point)
    {
    this.point = point; // Store point reference
    next = null; // Set next ListPoint as null
    }

    // Set the pointer to the next ListPoint
    public void setNext(ListPoint next)
    {
    this.next = next; // Store the next ListPoint
    }

    // Get the next point in the list
    public ListPoint getNext()
    {
    return next; // Return the next ListPoint
    }

    // Return String representation
    public String toString()
    {
    return "(" + point + ")";
    }

    private ListPoint next; // Refers to next ListPoint in the list
    private Point point; // The point for this list point
    }




    public class PolyLine
    {
    // Construct a polyline from an array of points
    public PolyLine(Point[] points)
    {
    if(points != null) // Make sure there is an array
    {
    // Create a one point list
    start = new ListPoint(points[0]); // 1st point is the start
    end = start; // as well as the end

    // Now add the other points
    for(int i = 1; i < points.length; i++)
    addPoint(points[i]);
    }
    }

    // Construct a polyline from an array of coordinates
    public PolyLine(double[][] coords)
    {
    if(coords != null)
    {
    // Create a one point list
    start = new ListPoint(new Point(coords[0][0], coords[0][1]));
    // First is start
    end = start; // as well as end

    // Now add the other points
    for(int i = 1; i < coords.length ; i++)
    addPoint(coords[i][0], coords[i][1]);
    }
    }

    // Add a Point object to the list
    public void addPoint(Point point)
    {
    ListPoint newEnd = new ListPoint(point); // Create a new ListPoint
    if(start == null)
    start = newEnd; // Start is same as end
    else
    end.setNext(newEnd); // Set next variable for old end as new end
    end = newEnd; // Store new point as end
    }

    // Add a point to the list
    public void addPoint(double x, double y)
    {
    addPoint(new Point(x, y));
    }

    // String representation of a polyline
    public String toString()
    {
    StringBuffer str = new StringBuffer("Polyline:");
    ListPoint nextPoint = start; // Set the 1st point as start
    while(nextPoint != null)
    {
    str.append(" "+ nextPoint); // Output the current point
    nextPoint = nextPoint.getNext(); // Make the next point current
    }
    return str.toString();
    }

    private ListPoint start; // First ListPoint in the list
    private ListPoint end; // Last ListPoint in the list
    }

    public class TryPolyLine
    {
    public static void main(String[] args)
    {
    // Create an array of coordinate pairs
    double[][] coords = { {1., 1.}, {1., 2.}, { 2., 3.},
    {-3., 5.}, {-5., 1.}, {0., 0.} };

    // Create a polyline from the coordinates and display it
    PolyLine polygon = new PolyLine(coords);
    System.out.println(polygon);

    // Add a point and display the polyline again
    polygon.addPoint(10., 10.);
    System.out.println(polygon);

    // Create Point objects from the coordinate array
    Point[] points = new Point[coords.length];
    for(int i = 0; i < points.length; i++)
    points[i] = new Point(coords[i][0],coords[i][1]);

    // Use the points to create a new polyline and display it
    PolyLine newPoly = new PolyLine(points);
    System.out.println(newPoly);
    }
    }





    the output is:
    Polyline: (1.0,1.0) (1.0,2.0) (2.0,3.0) (-3.0,5.0) (-5.0,1.0) (0.0,0.0)
    Polyline: (1.0,1.0) (1.0,2.0) (2.0,3.0) (-3.0,5.0) (-5.0,1.0) (0.0,0.0) (10.0,10.0)
    Polyline: (1.0,1.0) (1.0,2.0) (2.0,3.0) (-3.0,5.0) (-5.0,1.0) (0.0,0.0)


    I dont understand how the getNext method actually gets the next point.

  26. #26
    New Member
    Join Date
    Aug 2001
    Location
    Bay Area CA
    Posts
    2
    In PolyLine's constructors:

    start = new ListPoint(points[0]); // 1st point is the start
    end = start; // as well as the end

    So start and end now point to the same object. Then, in addPoint, you call:

    end.setNext(newEnd); // Set next variable for old end as new end

    But the first time you call addPoint, start and end point to the same object, so start.next now refers to the new point:

    start.next = point1

    You then set end to refer to point1, so the next time you call addPoint, you get:

    point1.next = point2

    And so forth.

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width