Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Understanding java basics words

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Understanding java basics words

    I'm going through a video tutorial and the instructor when saying certain words like "Instance, methods, object he selects the wrong one on the screen. Like for example when saying method he might select variable. So I want get this correct so I know what he is referring too.

    I've added comments to the following code and want to know if they're all correct.

    Question is:

    1. Which one is a method?
    2. Which is a function?
    3. Which one is a object?
    4. Which one is a instance of class?
    5. Which one is a method type?

    .


    class Person {

    // These are instance variables
    String name;
    int age;

    // This is a method - aka function?
    void sayHello() {
    System.out.println("Hello there!");
    }
    }

    public class App {

    public static void main(String[] args) {

    // Is `Person` a object? Or is `new Person()`; a object?
    // `Person` in `Person person1` is a method type?
    // `Person person1 = new Person();` is called instance of a class (Person class)?
    Person person1 = new Person();
    person1.name = "Joe Bloggs";
    person1.age = 37;
    person1.sayHello();

    }

    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Understanding java basics words

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    Person is the name of a class. new Person creates an instance of Person and that would be an object
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java basics
    By Mitia25 in forum Java Theory & Questions
    Replies: 3
    Last Post: January 29th, 2014, 12:46 PM
  2. Java Basics Question
    By Zebo999 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 29th, 2013, 03:28 PM
  3. Java networking basics
    By Earthly Minds in forum Java Networking Tutorials
    Replies: 0
    Last Post: June 9th, 2013, 07:50 PM
  4. Java - The bear basics
    By Earthly Minds in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: June 9th, 2013, 07:41 PM
  5. Java basics
    By tommyacton in forum Object Oriented Programming
    Replies: 5
    Last Post: January 5th, 2013, 07:39 AM