Completely stuck, get/set, Contructors and Static Methods

Hi any help would be very appreciated on this one,
import java.util.Scanner;
import java.io.*;*
*import java.util.*;
public class Course extends Program {
     public Course(String Coursecode, String Coursename){
          Coursecode = stuinput.courseCode;
public void getCoursecode(){
     return stuinput.courseCode;
//public String getCourseCode(){
//     return this.courseCode;
       public static void printCourses() throws Exception
            stuinput[] courseObjArray = new stuinput[18]; //Make sure this is the same as the ammount in the text
               Scanner sc = new Scanner(new File("courses.txt"));
               int i=0;
               boolean found = false;
               while(sc.hasNextLine())
               //Delimit this line with scanner
               Scanner sc1 = new Scanner(sc.nextLine());
               sc1.useDelimiter(":");
               courseObjArray[i] = new stuinput(sc1.next(),sc1.next());
               i++;
               }//while
               for(int i1 = 0;i1 < courseObjArray.length;i1++)
               System.out.println(courseObjArray[i1].courseCode);
               System.out.println(courseObjArray[i1].courseName);
               System.out.println("-----------------");          
       //This print the indexOf what you want to search
          class stuinput
          String courseCode = null;
          String courseName = null;
          stuinput()
          stuinput(String courseCode,String courseName)
          this.courseCode = courseCode;
          this.courseName = courseName;
import java.io.*;
public class gradCheck {
     public static void main (String args[]) throws Exception {
                  Course.printCourses(); //Prints All Course but dont need that
}This ^^^ Is basically the driver class, Im trying to run the printCourse() from the 1st Class I posted.....but it's giving me lots of errors with everything I try, I'm trying to get the values out of that text file and have them broken up so I can use them amoung various class's, I want to use those values inside the Course class, as well as the Program Class and other Class's that extend off of that,
Any Ideas (im sure there are because im very new), as to how I might to that
Thanks :-) would be much appreciated

yes, I still have a lot to learn here I think, Thank you so much, that worked for me, I think I need to read a lot about all of this and understand it......thank you
If I may, one more thing which I'm really stuck on and if I can get this right, I think my whole program and ideas will just fall into place...Ive been trying to a couple of weeks now and can't quit get it right
in the above code,
this bit,
          class stuinput
          String courseCode = null;
          String courseName = null;
          stuinput()
          stuinput(String courseCode,String courseName)
          this.courseCode = courseCode;
          this.courseName = courseName;
          }how do I pass this off to another class through the constructor
public class Course extends Program {
     public Course(){
     }at the top....say If I want it to be used in the Program class.......or a student class that extends of the this current class above (Course Class)
Thanks,

Similar Messages

  • HT1600 I have an apple tv  about two years old. Bought for a present and they never took it. I tried to hook it up cut it get stuck on setting time and date. Any help?

    I have an apple tv  about two years old. Bought for a present and they never took it. I tried to hook it up cut it get stuck on setting time and date. Any help?

    If you can view the main home screen, try selecting "settings" on the far right, then choose recent at the bottom. If not, try just unplugging power for a few minutes, then plug in and try again. Keep in mind you'll need a wireless connection and there may be several updates. Hope this helps-

  • HT1595 My apple tv stuck at setting date and time. Also when connecting yo network doesn't ask for network password

    My apple tv stuck at setting date and time. Also when connecting yo network doesn't ask for network password

    I just went through this last night. (Aug 15, 2013)
    What I did to get back up and running. This is not the first time I have lost the network connection with my Apple TV 3
    Products effected: Apple TV 3 and Home Sharing (My Apple TV 1 was not effected)
    Power down (unplug) the Apple TV and power down your router ( in my case, it is a FIOS router, flipping the on/off works fine).
    Power both items back up.
    At this point, I usually can reenter my Apple ID and PW. and reconnect Home Sharing.  But for some reason I was unable to reconnect last night but was able to get it reconnected in the morning. I was jut to tired to deal with it last night.
    A new issue that is was able to fix after a good nights sleep.
    I did figure out, (after trying to reenter my ID and PW many times and having it tell me that my ID and PW was wrong), that when using the Apple TV on screen keypad to type in the user ID. DO NOT use the ".com" keypad button. Instead type out each character for .com. ( or what ever ending you use for your ID account.)
    Once I typed out my full ID and PW. everything is back to 100%

  • What happened to the Get/Set Date and Time utilities from RT 7.1?

    I'd like to use the Get/Set Date and Time utilities that were available in 7.1, but disappeared after that. I see that the 7.1 utilites  call a dll that does not appear to be installed with LabVIEW RT 8 and later. What do I need to do to use the utilites from 7.1 that do not appear in later versions?

    In Labview 8.2 and later there are two directories for vi.lib. settime.dll is located in National instruments\Labview 8.2\Targets\NI\RT\ vi.lib
    This is the dll you want to use in order to call it use the same Vi as in 7.1 (RT set date and time.vi) and link it to the correct dll.

  • HT3180 stuck on setting time and date

    the screen is stuck oni setting date and time

    Welcome to the Apple Community.
    Assuming this is not the first time you have used your Apple TV
    You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Also try restarting the router. (Also try removing it’s power cord for at least 30 seconds)
    If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
    If restoring from the Apple TV doesn't help, try restoring from iTunes using a USB cable.
    If this is a new Apple TV, in addition to trying the above, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123.

  • HT5438 Stuck on setting date and time

    Apple TV stuck on setting date and time

    I read in another discussion that you can turn off your routers firewall temporarily and it will work. I did that. I turned off my apple tv (3rd gen) and then I turned off my routers firewall. Then I turned my apple tv back on and made sure the time setting was set to automatic. Then it let me set my iTunes login and everything was fine. I turned my firewall back on and it all works now. Try that. I'm not saying it will work for everyone, but it worked in my case.

  • My apple TV stuck on setting date and time.

    Tried to fix it with all the options you gave me on forum. Turned off, turned on, changed router, changed router settings and security level, even changed the ATV. Nothing works. Last week everything was fine. What should I do?

    Stuck on Setting Date and Time

  • HT1595 how do i access apple tv when screen is stuck at setting date and time

    how do i access apple tv when screen is stuck at setting date and time, have unplugged system,restarted router....

    Welcome to the Apple community.
    Assuming this is not the first time you have used your Apple TV
    You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Also try restarting the router.
    If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
    If this is a new Apple TV, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123.

  • Abstract classes and static methods

    I have an abstract report class AbstractReportClass which I am extending in multiple report classes (one for each report, say ReportA, ReportB, ...). Each report class has its own static column definitions, title, etc., which I have to access through a static method getDataMeta() in a web application. Each report has the same exact code in getDataMeta, and no report may exist without these fields. My intuition tells me that AbstractReportClass should contain the code for getDataMeta, but I know that you can't mix abstract and static keywords.
    Am I missing a simple solution to unify the getDataMeta code in the abstract base class? or do I really need to have a static function getDataMeta with the same code in each of the base classes?
    My apologies if this has been discussed many times before.
    Thanks,
    -Andrew

    I'm not trying to be "right"; rather I just asked a question about whether I can do something that seems intuitive. Perhaps you might write code in a different way than I would or perhaps I wasn't clear about every little detail about my code? Do you regularly belittle people who ask questions here?
    I have a loadFromDB() member function in AbstractReport for which all sub classes have an overloaded version. All reports I'm displaying have 4 common fields (a database id and a name and a monetary value, for example), but then each other report has additional fields it loads from the database. Inside ReportX classes' loadFromDB(), I call the superclass loadFromDB() function and augment values to get a completely loaded object. In fact, the loadedData member object resides in AbstractReport.
    I can't use a report unless it has these common features. Every report is an AbstractReport. There is common functionality built on top of common objects. Isn't this the point of inheritance? I'm essentially saying that abstract class Shape has a getArea function and then I'm defining multiple types of Shapes (e.g. Rectangle and Circle) to work with...

  • Datacorruption and static methods

    public static void myMethod( String Argument)
         int i = 0 ;
    What are the chances of data corruption in this static method?
    IF there are chances of data corruption, am I corrupt in saying that chances of data corruption for argument and Variable i are same?
    Where is function state stored in static method stored? What will happen to this if one thread pre-empts other?
    public class a
         int j;
         public static void myMethod( String Argument)
              int i = 0 ;
    How is integer j different from integer i? Where will JVM keep these variables ?

    What are the chances of data corruption in this static
    method? None. As long as this static method only acts on local variables (variables declared inside the method) each call to the method is completely separate from any other call.
    Where is function state stored in static method
    stored? What will happen to this if one thread
    pre-empts other?I'm not sure what you mean by 'function state' but static methods are not associated with an Object, though they can modify and depend on the state of static (class) varaivbles.
    How is integer j different from integer i? Where will
    JVM keep these variables ? j is a member varaible. It is associated wth the instance of the class. i is a local variable and is created at the beginning of a method call and destroyed (eventually) after the method completes.

  • Generics and static methods

    Hi,
    I need a sanity check to make sure I have not missed design pattern.
    I believe that it is not possible to call a static method defined in a generic type.
    For example:
    public class Red extends Color
        public static Color getHue()
    public class Green extends Color
        public static Color getHue()
    public class GenericColorTest<C extends Color>
        public void fooBar()
             Color hue= C.getHue();  // Is this a valid method call ?
    }Since the base class Color can not define static methods, it seems resonable that a generic type can't make the call to get getHue(). Or am I missing something ? Is there a way for the class GenericColorTest's generic type C to call a static method ?
    Thanks
    HB

    I think I can be ever more specific than gafter on this.
    Your call, "C.getHue()", just plain makes no sense. C is "some kind of Color object", and the class "Color" has no function (static or not) called "getHue()". So calling "C.getHue()" is a simple case of you trying to call a function that isn't in the class.
    In fact you can call static functions, but only if they are in the base class require by the generic definition (erm, sorry can't remember the exact term right now). So, for example, if there was a "getHue()" static function in your class "Color", then sure, you can call "C.getHue()" in your code. But since static functions can't be overridden, the "C.getHue()" will do exactly the same thing no matter which actual class C was at the moment, which doesn't seem to be what you want.
    The right thing to do is just make "getHue()" non-static. Then things will work great.

  • Regarding Returning Parameter and Static method

    Hi frnds,
    I am learning oops ABAP. I want to use returning parameters in method and also STATIC METHOD.
    If any example it will be more helpful
    regards,
    satya

    Hi satya,
                 Check this out ,Its helpful.
    To get some values from a method , one can use the exporting, changing or returning parameters.If one uses RETURNING parameters, the following restrictions apply:-(1) No EXPORTING/CHANGING parameters can be used for the method.(2) Only one RETURNING parameter can be used.(3) RETURNING parameters are only passed by value.This program demonstrates the use of RETURNING parameters and the various ways   to call a method with RETURNING parameter to get the value into some variable.
    Sample Program
    </code>
    report ysubdel1 message-id 00.
    data : w_num type i.
    class c1 definition .
    public section. 
    methods : m1 importing input1 type i
                            input2 type i
                            returning value(result) type i .
    endclass.
    class c1 implementation.
    method  : m1.
    result = input1 * 2 + input2.
    endmethod.
    endclass.
    start-of-selection.
    data : obj1 type ref to c1 . 
    create object obj1.
    Syntax 1     
    call method obj1->m1 EXPORTING input1 = 5                                                        input2 = 4  
                                   RECEIVING result = w_num.  
      write:/5 w_num .
    Syntax 2
         w_num = obj1->m1( input1 = 10 input2 = 20 ).
      write:/5 w_num .
    Syntax 3     
    move obj1->m1( input1 = 2 input2 = 3 ) to w_num .  
    write:/5 w_num .
    </code>
    Static method example
    <code>
    REPORT  zstatic.                              .
    data : num type i.
    class testclass definition.
    public section.
      class-methods : testmethod.
    endclass.
    class testclass implementation.
    method : testmethod.
      num = 5.
      write:/5 num.
    endmethod.
    endclass.
    start-of-selection.
    call method testclass=>testmethod.
    </code>
    Reward Points if u find helpful.
    Thnks & Regards,
    Rajesh

  • Stuck on setting date and time

    Apple TV is new, straight out of box.  I'm getting to the screen that says "Setting date and time. . ."  Then it stays stuck there.  If I bypass this screen, everything except date and time is set up, and because this is not set up, nothing is working.  All other devices hooked up to wifi in the house are working and I've unplugged and reset the Apple TV and the router.  How do I get this device to set the date and time?

    Welcome to the Apple Community.
    Assuming this is not the first time you have used your Apple TV
    You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Also try restarting the router.
    If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
    If restoring from the Apple TV doesn't help, try restoring from iTunes using a USB cable.
    If this is a new Apple TV, in addition to trying the above, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123.

  • How to get the class name  static method which exists in the parent class

    Hi,
    How to know the name of the class or reference to instance of the class with in the main/static method
    in the below example
    class AbstA
    public static void main(String[] args)
    System.out.println(getXXClass().getName());
    public class A extends AbstA
    public class B extends AbstA
    on compile all the class and run of
    java A
    should print A as the name
    java B
    should print B as the name
    Are there any suggestions to know the class name in the static method, which is in the parent class.
    Regards,
    Raja Nagendra Kumar

    Well, there's a hack you can use, but if you think you need it,Could you let me the hack solution for this..
    you probably have a design flaw and/or a misunderstanding about how to use Java.)May be, but my needs seems to be very genuine..of not repeat the main method contents in every inherited class..
    The need we have is this
    I have the test cases inheriting from common base class.
    When the main method of the test class is run, it is supposed to find all other test cases, which belong to same package and subpackages and create a entire suite and run the entire suite.
    In the above need of the logic we wrote in the main method could handle any class provided it knows what is the child class from which this main is called.
    I applicate your inputs on a better way to design without replicating the code..
    In my view getClass() should have been static as the instance it returns is one for all its instances of that class.
    I know there are complications the way compiler handles static vars and methods.. May be there is a need for OO principals to advance..
    Regards,
    Raja Nagendra Kumar
    Edited by: rajanag on Jul 26, 2009 6:03 PM

  • Nested Classes and Static Methods

    I was perusing the Java Tutorials on Nested Classes and I came across this...
    [http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html|http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html]
    I was reading the documentation and I read a slightly confusing statement. I was hoping some further discussion could clarify the matter. The documentation on "Nested Classes" says (I highlighted the two statements, in bold, I am having trouble piecing together.)
    Static Nested Classes
    As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class ? it can use them only through an object reference.
    Note: A static nested class interacts with the instance members of its outer class (and other classes) just like any other top-level class. In effect, a static nested class is behaviorally a top-level class that has been nested in another top-level class for packaging convenience.
    So this means a nested static inner class CANNOT refer to its own instanced variables, like a normal static method, but CAN refer to its outer class instanced variables?

    So this means a nested static inner class CANNOT refer to its own instanced variables, like a normal static method, but CAN refer to its outer class instanced variables?No, it means that a static nested class cannot refer to instance variables of its enclosing class. Example:public class Foo {
        int i;
        static class Bar {
            int j = i; // WRONG! Bar class is static context
    }~

Maybe you are looking for

  • Multiple fax/email contacts for same Vendor - How to set it up for Output

    Hi All We have two different plant using same vendor A but their contacts are different. for example. Plant 1000 has the contact as Rep1 with fax 1 and email1                    and Plant 2000 has the contact as Rep 2 with fax 2 and email 2 We would

  • HOW TO USE LEXICAL PARAMETER IN FORMS9I

    CAN I USE LEXICAL PARAMETER IN FORMS9I I WANT TO CREATE QUERY LIKE THIS SELECT * FROM &TABLE_NAME WHERE &CHOICE WHERE &TABLE_NAME = EMP, AND &CHOICE EMPNO=12344 PLS HELP

  • WRT160N v2 as access point inside LAN

    I got this router and I need to set it as an Access Point (will not be using the routing functionality) in the far side of our building. Our LAN uses IP addresss in the range 10.*.*.* with subnet 255.0.0.0, so I need to put the access point ino this

  • Execute unix commands from Java

    Hi, I have a client application running on windows. This client should connect to a unix server and check for the existence of a file and display the result as "File found/File not found". In order to connect from windows to the unix server, I used t

  • Applescript get html without safari

    I need to get html of a website and make some javascript's on it. I think only way is "tell applicaiton Safari" but I don't want Safari. Thanks in advance