Help in Java from any expert.

Hi, i am new to the Java language, and am taking it in school. Unfortunately, my teacher has never taught grade 11 Java before and so he doesnt really understand what to teach us. He expects us to know a lot of things that we dont, and tries to make us do riduclous things (on tests, even!) that we have never heard of. He only teaches interesting things to his favourite students, and to the rest of us he gives a really bad explanation, which he refuses to comment on.
I have a couple of questions for you guys, since you're all probably experts here. IF you dont mind answering them, it would be great. I will ask more in the future, but for now:
1) What is an object? I really dont understand how you can have objects in java. What can they do, wht characteristics do they have?
2) What is inheritance? i understand what the word means, but how can this relate to Java? provide an example if you can, please.
3)How do threads work? If i wanted to make a a character that moves around a screen, while another character is doing the same thing, how would i make the thread do that?
Thanks for all the help.

First let me say that the answers that preceded this one really do have all you need to know, and they came from real experts. I'll take a stab at answering your actual questions:
Hi, i am new to the Java language, and am taking it
in school. Unfortunately, my teacher has never taught
grade 11 Java before and so he doesnt really
understand what to teach us. He expects us to know a
lot of things that we dont, and tries to make us do
riduclous things (on tests, even!) that we have never
heard of. He only teaches interesting things to his
favourite students, and to the rest of us he gives a
really bad explanation, which he refuses to comment
on.I cannot comment on your teacher, but I suspect your view is coloured by the fact that you are not one of the "favorites".
I have a couple of questions for you guys, since
you're all probably experts here. IF you dont mind
answering them, it would be great. I will ask more in
the future, but for now:We're not all "experts", but many of us are professional programmers working in the Java language at the present time. this may not always be the case in the future.
1) What is an object? I really dont understand how
you can have objects in java. What can they do, wht
characteristics do they have?An "object" is a construct in a computer language that may have both state and behaviour.
By state we mean that the object has some attributes or variables that define how it differs from other objects of the same type, or even from itself at a different time. An example of state is that the object could have a colour and an age. The colour would be permanent, but the age would tend to vary with time.
Behaviour is how the object reacts to messages, as an example the object might have a good or bad attitude. The behaviour is determined by the class of the object. So you could have GoodyTwoShoes objects with a much too good attitude and BaddAss objects with a bad attitude.
2) What is inheritance? i understand what the word
means, but how can this relate to Java? provide an
example if you can, please.Your GoodyTwoShoes and BaddAss classes could both derive from the same class. For example that class could be TypicalStudent, it would have many common behaviours like eatsLunch, ridesBus, attendsFootballGames, goesOnDates etc. these would be inherited from the TypicalStudent class, but the disruptsClasses and brownNose behaviours would not be inherited.
3)How do threads work? If i wanted to make a a
character that moves around a screen, while another
character is doing the same thing, how would i make
the thread do that?Threads are like small interior processes that appear to run independently, even though they have access to the same memory. So your 2 characters could both access the Window, but would have seperate x and y coordinates and motion attributes. They would appear to move independently because the system would allocate resource to them in turn, just how it does that isn't relevant at your level.
Thanks for all the help.You are welcome, now it's time to hit the books, I suggest you start with "Head First Java", it's comprehensive, fun to read and will teach you a lot. The other books recommended above are all very good, but may be a bit too advanced.

Similar Messages

  • JInternalFrame help!!! any expert in here?

    How do u put an panel inside the JInternalFrame? And how do you put an panel containing buttons inside that first panel which is inside the JInternalFrame.
    help

    k here is all the full coding of what i am working on.
    // Java core packages
    import java.awt.*;
    import java.awt.event.*;
    // Java extension packages
    import javax.swing.*;
    public class Test extends JFrame {
    private JDesktopPane theDesktop;
    // set up GUI
    public Test()
    super( "test" );
    // create menu bar, menu and menu item
    JMenuBar bar = new JMenuBar();
    JMenu addMenu = new JMenu( "Add" );
    JMenuItem newFrame = new JMenuItem( "Internal Frame" );
    addMenu.add( newFrame );
    bar.add( addMenu );
    setJMenuBar( bar );
    // set up desktop
    theDesktop = new JDesktopPane();
    getContentPane().add( theDesktop );
    // set up listener for newFrame menu item
    newFrame.addActionListener(
    // anonymous inner class to handle menu item event
    new ActionListener() {
    // display new internal window
    public void actionPerformed( ActionEvent event ) {
    // create internal frame
    JInternalFrame frame = new JInternalFrame(
    "Internal Frame", true, true, true, true );
    // attach panel to internal frame content pane
    Container container = frame.getContentPane();
    NewMember panel = new NewMember();
    container.add( panel, BorderLayout.CENTER );
    // set size internal frame to size of its contents
    frame.pack();
    // attach internal frame to desktop and show it
    theDesktop.add( frame );
    frame.setVisible( true );
    } // end anonymous inner class
    ); // end call to addActionListener
    setSize( 600, 440 );
    setVisible( true );
    } // end constructor
    // execute application
    public static void main( String args[] )
    DesktopTest application = new DesktopTest();
    application.setDefaultCloseOperation(
    JFrame.EXIT_ON_CLOSE );
    } // end class DesktopTest
    class NewMember extends JFrame {
         JButton btnCancel = new     JButton("Cancel");
         JButton btnSubmit= new JButton("Submit");
         JLabel lblLastName = new JLabel ("Last Name", JLabel.CENTER);
         JLabel lblFirstName = new JLabel ("First Name", JLabel.CENTER);
         JLabel lblMidle = new JLabel ("Midle Name", JLabel.CENTER);
         JLabel lblAddress = new JLabel ("Address", JLabel.CENTER);
         JLabel lblCity = new JLabel ("City", JLabel.CENTER);
         JLabel lblState = new JLabel ("State", JLabel.CENTER);
         JLabel lblZipCode = new JLabel ("Zip Code", JLabel.CENTER);
         JLabel lblPhone = new JLabel ("Phone Number", JLabel.CENTER);
         JLabel lblCredit = new JLabel ("Credit Card #", JLabel.CENTER);
         JLabel lblFormTile = new JLabel ("VIDEO MEMBERSHIP APPLICATION FORM", JLabel.CENTER);
         JTextField txtLastName = new JTextField();
         JTextField txtFirstName = new JTextField();
         JTextField txtMidle = new JTextField();
         JTextField txtAddress = new JTextField();
         JTextField txtCity = new JTextField();
         JTextField txtState = new JTextField();
         JTextField txtZipCode = new JTextField();
         JTextField txtPhone = new JTextField();
         JTextField txtCredit = new JTextField();
    NewMember() {
         Container c = getContentPane();
         c.setLayout (null);
         c.add(txtLastName);
         c.add(txtFirstName);
         c.add(txtMidle);
         c.add(txtAddress);
         c.add(txtCity);
         c.add(txtState);
         c.add(txtZipCode);
         c.add(txtPhone);
         c.add(txtCredit);
    c.add(lblLastName);
    c.add(lblFirstName);
    c.add(lblMidle);
    c.add(lblAddress);
    c.add(lblCity);
         c.add(lblState);
    c.add(lblZipCode);
    c.add(lblPhone);
    c.add(lblCredit);
    c.add(lblFormTile);
    c.add(btnCancel);
    c.add(btnSubmit);
    lblFormTile.setBounds (35, 0, 400, 40);
    lblLastName.setBounds (30, 50, 150, 30);
    lblFirstName.setBounds (30, 80, 150, 30);
    lblMidle.setBounds (30, 110, 150, 30);
    lblAddress.setBounds (30, 140, 150, 30);
    lblCity.setBounds (30, 170, 150, 30);
    lblState.setBounds (30, 200, 150, 30);
    lblZipCode.setBounds (30, 230, 150, 30);
    lblPhone.setBounds (30, 260, 150, 30);
    lblCredit.setBounds (30, 290, 150, 30);
    txtLastName.setBounds (150, 50, 150, 25);
    txtFirstName.setBounds (150, 80, 150, 25);
    txtMidle.setBounds (150, 110, 150, 25);
    txtAddress.setBounds (150, 140, 150, 25);
    txtCity.setBounds (150, 170, 150, 25);
    txtState.setBounds (150, 200, 150, 25);
    txtZipCode.setBounds (150, 230, 150, 25);
    txtPhone.setBounds (150, 260, 150, 25);
    txtCredit.setBounds (150, 290, 150, 25);
    btnCancel.setBounds (200, 350, 120, 30);
    btnSubmit.setBounds (50, 350, 120, 30);
         setSize(500,450);
         setTitle("VIDEO'S NEW MEMBERSHIP");
         setVisible(true);
         setResizable(false);
    Am I doing it correctily? is this the way one should be doing it in terms of adding a Jpanel inside an internalFrame?

  • How to create an incentive same as LPC and PPI in ISU.  Any help from the experts as it is an urgent requirement of the client.

    How to create an incentive same as LPC and PPI in ISU.  Any help from the experts as it is an urgent requirement of the client.

    Hi,
    It depends on fact that when you want to create the incentive.
    If you want to create at the time of invoicing, then you have to enhance event R402.
    If you want to create at the time of payment, the you have to enhance event 0032.
    Hope it helps
    Thanks,
    Amlan

  • I am having a problem with pop pups and small windows with ads constantly opening up on my safari?? Thought that macs didn't get virus? this looks like one- any experts around? please help me fix it with your instructions? really don't know what to do...

    Hi everyone,
    I am having a problem with my Mac OS X 10.7.5 mac book air , there are constant pop pups and small windows with ads blinking constantly opening up on my safari in front of everything?? it is constantly interupting me and makes me mistakingly click on it then another new windows open behind the one im using..
    I am not too sure if thats a virus or trojan.. I always thought that macs didn't get virus? this looks like one to me… any experts around? please help me fix it with your instructions? really don't know what to do... thanks

    Those are not viruses. You have probably installed some malware:
    The Safe Mac » Adware Removal Guide
    Helpful Links Regarding Malware Protection
    An excellent link to read is Tom Reed's Mac Malware Guide.
    Also, visit The XLab FAQs and read Detecting and avoiding malware and spyware.
    See these Apple articles:
              Mac OS X Snow Leopard and malware detection
              OS X Lion- Protect your Mac from malware
              OS X Mountain Lion- Protect your Mac from malware
              About file quarantine in OS X
    If you require anti-virus protection Thomas Reed recommends using Dr.Web Light from the App Store. It's free, and since it's from the App Store, it won't destabilize the system. If you prefer one of the better known commercial products, then Thomas recommends using Sophos.(Thank you to Thomas Reed for these recommendations.) If you already use Sophos, then be aware of this if you are using Mavericks: OS X Mavericks- Sophos Anti-Virus on-access scanner versions 8.0 - 9.1 may cause unexpected restarts
    From user Joe Bailey comes this equally useful advice:
    The facts are:
    1. There is no anti-malware software that can detect 100% of the malware out there.
    2. There is no anti-malware that can detect anything targeting the Mac because there
         is no Mac malware in the wild, and therefore, no "signatures" to detect.
    3. The very best way to prevent the most attacks is for you as the user to be aware that
         the most successful malware attacks rely on very sophisticated social engineering
         techniques preying on human avarice, ****, and fear.
    4. Internet popups saying the FBI, NSA, Microsoft, your ISP has detected malware on
        your computer is intended to entice you to install their malware thinking it is a
        protection against malware.
    5. Some of the anti-malware products on the market are worse than the malware
        from which they purport to protect you.
    6. Be cautious where you go on the internet.
    7. Only download anything from sites you know are safe.
    8. Avoid links you receive in email, always be suspicious even if you get something
        you think is from a friend, but you were not expecting.
    9. If there is any question in your mind, then assume it is malware.

  • Is there any way to prevent web.xml from any change like java class?

    hi all,
    Is there any way to prevent web.xml from any change after making EAR(WAR)?
    One can easily make a change in web.xml and redeploy the application to get the result. Now we want to restrict the web.xml as java class for any change after making EAR(or WAR).
    Could some one help me to do this?
    thanks,
    dinesh

    hi,
    Not at development level. We want it after deploying the application on server .
    We want to create it (web.xml) at tomcat startup (or in any other web/app server ) before loading any context.
    Is there any way to run a simple java class(not servlet) on tomcat startup(before initializing the contexts)?
    Message was edited by:
    DP_java
    Message was edited by:
    DP_java

  • How to call windows help files .hlp from Java program

    Hai all everybody
    How to call windows Help file that is xxx.hlp files from java programs
    any help great!!!!
    regards
    veeru

    How about
    Runtime.getRuntime().exec("start xxx.hlp");

  • Java update 2012-006 did not remove Java plugin from any browser

    I successfully installed Java update 2012-006 via Software Update on my iMac running OS X Lion 10.7.5 (German) and it updated the Java runtime to version 1.6.0_37 and removed the Java Preferences application as expected, but it did not remove the Java plugin from any browser!
    Safari and Firefox can still use the Java plugin as before.
    I repaired permissions, rebooted, manually downloaded Java update 2012-006 and successfully installed it again without any change to the Java plugin: it is still present on my system and fully functional from any browser!
    The web is full with messages from users missing the Java plugin after installing this update - but I could not find anything about the plugin not being removed!
    Is anyone experiencing the same behaviour under Lion? I thought this would happen only under Snow Leopard...
    What should I do now? Can I really trust this "successfull installation" of Java update 2012-006 on my system?
    Thanks,
    Michael

    Thanks - I will keep the symlink in place and I won't touch the Deploy bundle, because I need the plugin in Safari and I don't need Oracle's Java 7 for now...
    If the plugin is supposed to stay in the Deploy bundle, this could help others who miss the plugin - they could just recreate the symlink, right?
    To summarize I think we can state, that the Java update 2012-006 for Lion and Mountain Lion sometimes leaves the symlink in /Library/Internet Plugins/ untouched.
    The circumstances that lead to this behaviour are still unknown.
    The install log in Console shows that the scripts to create links and to delete obsolete files ran okay, but there was an error with the "postinstall" script. In spite of this the installation succeeded:
    Oct 20 16:24:52 michaels-imac Installer[284]: Java für OS X 2012-006  Installation Log
    Oct 20 16:25:56 michaels-imac _securityagent[305]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[307]: Begin script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[309]: End script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[310]: Begin script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[314]: End script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[318]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[320]: Begin script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: com.apple.mrt.uiagent: Invalid argument
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt
    Oct 20 16:25:56 michaels-imac _securityagent[334]: End script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: Installed "Java für OS X 2012-006" ()
    Oct 20 16:25:56 michaels-imac Installer[284]: Displaying 'Install Succeeded' UI.
    Does anybody know what "com.apple.mrt.uiagent" and "com.apple.mrt" stands for?
    Obviously the "postinstall" script provides an invalid argument (at least on my system).
    I have no idea if this is related to the Java Plugin symlink not being removed...

  • Dear All, I can't play flash videos from any web site through firefox because it freezes but when i run firefox as administrator then it works fine (But Google Chrome Plays all videos normally.) . I am using Windows 7 & Firefox 7.0.1. Please help

    Dear All,
    Firefox hangs when i try to play flash videos from any site but when i run firefox as administrator it works fine. (but Google Chrome, Opera & I.E9 Plays videos without running as administrator.) I am using Windows 7 & Firefox 7.0.1. Please help.

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.com/kb/Server+not+found
    *https://support.mozilla.com/kb/Firewalls

  • Z87-GD65 wont boot from any drive, please help!

    I desperately need your help on this issue. And thanks in advance for any answer!
    I have a brand new Z87-GD65 Mainboard.
    When I select my boot device in BIOS all I get is: "Reboot and select proper boot device or insert boot media in selected boot device and press a key"
    In BIOS I can find all my hardware (CPU, Drives, HDDs, DVD,... RAM) everything is shown correctly. Nothing missing there, all parts shown by correct values.
    I cant boot through my DVD Drive or external USB Drive (on both I have Windows 7 which I want to install on my new system). The Windows DVD is also working properly, I checked it on my old PC.
    No matter what Boot priority/device I choose (I think Ive tried them all by now) "Reboot and select proper boot device or insert boot media in selected boot device and press a key" is what I get after "save & reboot".
    My BIOS Version is E7845IMS V1.8.
    Any suggestions, what am I missing?
    thank you very much for any help!

    Quote from: Jimmy_123 on 09-May-14, 01:26:52
    Ok, thanks for your help, I found the problem!
    It was my DVD Rom Drive that could not read the DVD!!!!
    What I Still dont understand is that it also didnt boot from a bootable HD through USB.
    thanks for your help!
    Glad you got it working....probably the controller got confused from the faulty DVD rom....

  • When I print to PDF using Acrobat 11 Pro from any application the acrobat Reader does not launch automatically. Associations are correct. Thx for your help,  Bruce

    When I print to PDF using Acrobat 11 Pro from any application the acrobat Reader does not launch automatically. Associations are correct. Happens from Chrome, IE, Word, Excel, Powerpoint. Previously had deskPDF installed but uninstalled correctly. Can't find a preference setting for the auto launch. Thx for your help,  Bruce

    A simple way is to flatten the form fields, which converts the field appearances to regular page contents. You can do this with JavaScript or PDF Optimizer (Advanced > PDF Optimizer > Discard Objects > Flatten form fields). A very nice script that adds a custom menu item can be found here: http://www.uvsar.com/projects/acrobat/flattener/

  • Helpful Information about getting music from ANY ipod onto your itunes!!!

    This is a message letting all Windows itunes users how to put music from any ipod onto their itunes, or other music player. Many people are annoyed when itunes doesn't let them put music from an ipod, thats not registered with their computer, into their itunes. I found that it is possible. First, you must open Search from the start menu and make sure your ipod is connected to your computer. Next, set the search prefrences to search for hidden files and tell it to search for music(on the ipod). Once you begin the search, you will be shown all the hidden music files that are on your ipod. After the search, just drag the files to itunes and they'll import.*
    *Note: the files wont say the names of the songs until you import them into itunes or any other music player.
    PowerbookG4   Mac OS X (10.4.9)   Helpful Info for Windows

    This is a message letting all Windows itunes users
    how to put music from any ipod onto their itunes, or
    other music player. Many people are annoyed when
    itunes doesn't let them put music from an ipod, thats
    not registered with their computer, into their
    itunes. I found that it is possible. First, you must
    open Search from the start menu and make sure
    your ipod is connected to your computer. Next, set
    the search prefrences to search for hidden
    files and tell it to search for
    music(on the ipod). Once you begin the search, you
    will be shown all the hidden music files that are on
    your ipod. After the search, just drag the files to
    itunes and they'll import.*
    *Note: the files wont say the names of the songs
    until you import them into itunes or any other music
    player.
    PowerbookG4
      Mac OS X (10.4.9)   Helpful Info for
    Windows

  • After updating to 12.0, I can't copy and paste images from any website; instead of the image pasting, the URL for the image pastes instead; help, please?

    This applies to copying from any website, and pasting to any and all applications. This is exactly coincidental to install of 12.0. This is a basic, common, and essential function of any web browser. I've read various unacceptable "workarounds" in a couple posts, and am respectfully requesting a truly professional response from Firefox re: what exactly can be done to restore this basic, elementary function. I have been a major Firefox fan up until now, and need it to provide this basic functionality in a dependable way - simple right-click, copy image, and paste the image (not it's URL). Thanks for helping (hopefully).

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • I have an iphone 3gs. i do not get push notifications from any application. can you help me?

    I have an iphone 3gs. i do not get push notifications from any application. can you help me?

    Do you have Notifications turned On and setup for each desired app?
    Settings > Notifications

  • HT3702 How can I stop and remove my credit card from my iPad ,my children keep buying games and I want to stop it......please help me to remove any payment from now on.

    How can I stop and remove my credit card from my iPad ,my children keep buying games and I want to stop it......please help me to remove any payment from now on.

    iOS: Understanding Restrictions
              http://support.apple.com/kb/HT4213

  • Can we call simple a java application from any one of this AS adapters

    Can we call a simple java application from any one of this AS adapters?
    Prakash
    Message was edited by:
    user629857

    You can achieve this using LiveCycle PDF Generator JAVA API. You can find required code here:
    Adobe LiveCycle * Quick Start (SOAP mode): Converting a Microsoft Word document to a PDF document using the Java API
    In parameters:
    //Set createPDF2 parameter values
    String adobePDFSettings = "Standard";
    String securitySettings = "No Security";
    String fileTypeSettings = "Standard OCR";
    "Standard OCR" file type setting will run OCR on input pdf. In the code, instead of doc file provide a pdf file. Resultant pdf will be searchable PDF i.e OCRed PDF.
    Feel feel to ask any further questions.

Maybe you are looking for

  • ITunes U Collection artwork not displaying?

    I was recently troubleshooting an issue where some of our iTunes U Collection's artwork were not displaying correctly,  represented by the generic iTunes U thumbnail. I then discovered the GIF image format is no longer supported http://itunes.apple.c

  • Charting alternative to Sitraka JCClass

    Our application has a need for displaying data in charts in pie, bar and plot formats. We also have a need for tabbing in a table view of the data (i.e. be able to tab from one editable cell to the next). To solve these issues, we adopted JCClass Liv

  • How long before i can use coin to war bucks on gun bros after i buy the package

    i bought the package and it wont let me do it whys this

  • Wanting to make a high quality slide show

    I have pse 5 and want to make slide shows. I know that I must save the show to .wmv. Please give me some tips on making the best quality HD tv slide show using pse 5. I am primarily concerned with visual quality, not features such as a 1000 different

  • One VM Cluster Resources Regularly Failing

    Hi All, We run hundreds of Windows and Linux VMs in clustered and non-clustered environments. However, we're having issues with one particular VM that regularly restarts itself. The environment the problem VM is running in is a Windows 2012 R2 cluste