Hi ,all in this code ,i read filename in package filename using path ,,now i want to read the file B.java that also exist in package filename and relationship between them is inhretance.. "extends" keyword. in this (public class filename extends B ), but not write B.java in path ,i want to read any file after extends keyword in program filename. can anyone help me. i mean i want to read any file.java that come after extends keyword. public class CyclomaticComplexity{ public static void main(String[] args) { try { fileName = "C:\\NetBeansProjects\\filename\\src\\filename\\filename.java"); FileReader fr = new FileReader(fileName); BufferedReader br = …

Member Avatar
Member Avatar
+0 forum 18

I have two classes A Dog class whose constructor does not accept arguments, `public class Dog<pet> extends Animal<pet>{}` whose constructor does not accept any arguments and `public class Animal<pet>{}` whose constructor accepts one argument public class Dog<pet> extends Animal<pet>{ public Dog(){ super(/*what should go here?*/); //Constructor accepts no arguments } } public class Animal<pet>{ public Animal(E name){ //Constructor accepts one argument } } I need to pass an E type argument to super() inside the constructor of the Dog<pet> class. How can I do this without passing any arguments to the dog constructor? Thanks

Member Avatar
Member Avatar
+0 forum 3

Hi All, I have this code in my tableView; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { YFRFormViewController *formViewController = [[YFRFormViewController alloc] init]; NSArray *campaigns = [[YFRCampaigns currentCampaigns] allCampaigns]; YFRCampaignForm *selectedCampaign = campaigns[indexPath.row]; // Give formViewController a pointer to the item object in row formViewController.campaignForm = selectedCampaign; // Push it onto the top of the navigation controller's stack [self.navigationController pushViewController:formViewController animated:YES]; } In the "campaigns" array are objects from classes that have extended YFRCampaignForm. When I select one I want it to bring up the view data for that object. At the moment it is being put in a YFRCampaignForm. I assume …

Member Avatar
+0 forum 0

I need to write a program that can draw stuff on a frame, let's say, trees. Their IDs, colors, positions etc. are in a **txt file**, line by line, the first word of the line is the name of their type which will be the name of the subclass. These parameters are given by the **"Trees" class**. The **drawing method of the various types of trees** are written in **subclasses**. So I thought I should make a **class for getting the data from the text file** and then pass the scanner as a parameter to the Trees class' constructor, where …

Member Avatar
Member Avatar
+0 forum 8

Hi I'm having issue of understand how to **echo** a variable when the `class` is `extended`. I have **2** files. This is my **index.php** file: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OOP Example</title> <?php include("class.php"); ?> </head> <body> <?php $mitch = new person("Mitch Last"); echo "Mitch's full name: " . $mitch->get_name();"</br>"; $last = new coworker("Last Mitch"); echo "</br>Last's full name: " . $last->get_name();"</br>"; $slim = new coworker("Slim Jim"); echo "</br>Slim's full name: " . $slim->get_name();"</br>"; ?> </body> </html> This is my **class.php** file: <?php class person { // To defined adding class properties are optional var $name; …

Member Avatar
Member Avatar
+4 forum 15

import java.util.*; public class GenericDemo4 { public static void main(String r[]) { Set s1 = new HashSet(); s1.add(0); s1.add("1"); dostuff(s1); } static void dostuff(Set<Number> s) { do2(s); Iterator i = s.iterator(); while(i.hasNext()) System.out.println(i.next() + " "); Object [] oa = s.toArray(); for(int x = 0; x<oa.length; x++) System.out.println(oa[x] + " "); System.out.println(s.contains(1)); } static void do2(Set s2) { System.out.println(s2.size() + " "); } } On line 10 there is a type-safe set as a parameter for the method dostuff and it accepts non generic Set s1. How can it not flag an error for one of it's element being a …

Member Avatar
Member Avatar
+0 forum 7

My Java is pretty rough. So far I've completed one class of Java all the way up to basic array functions. I've asked my Professor to explain it, but he talks with so much jargon. Could someone explain to me why this program spits out the "24" when I run it? O.o I learned when changing any of the numbers, at least at the bottom (8,4,2), to '0', I get an error of "dividing by zero". But I couldn't figure out how that worked. //#2 from Spring 2011 Test #2 public class T1b { protected int a; public T1b(int aIn) …

Member Avatar
Member Avatar
+0 forum 8

Hello all, I have an assignment in which I need to subclass and implement an abstract method (java.io.OutputStream) to create an output stream called NumStream. The NumStream class converts digits to strings. We are given most of the code it seems and I need to only implement one area. It seems when I type System.out.println("test"); it prints it 24 times. How do I get it to compare the actual string and print out the correct words for it? [CODE]import java.io.*; public class NumStream extends OutputStream { public void write(int c) throws IOException { //What goes here? } public static void …

Member Avatar
Member Avatar
+0 forum 2

Working on this program that uses 2 classes and a client program to test them, I keep getting this error pointing at my constructor, not sure what i am doing wrong but could use some assistance if anyone is able to offer, the error i am getting is: cannot find symbol, constructor GroceryList() line 25 [CODE] GroceryList tempItemOrder = new GroceryList(); [/CODE] here are the files... [CODE] import java.util.*; public class GroceryList extends GroceryItemOrder { private int size = 10; int[] items = new int[size]; //default constructor to handle normal data public GroceryList(String name, int quantity, double unitPrice) { super(name,quantity,unitPrice); …

Member Avatar
Member Avatar
+0 forum 13

Hi everybody I'm trying to write such a code: [CODE] import pps.PPSFrame; public class X extends PPSFrame{ ..... } [/CODE] Of course there's no such pps package in java. Where can i find it ? or at least PPSFrame.class ? Regards,

Member Avatar
Member Avatar
+0 forum 6

I have the following codes: [CODE] <?php class LongName { var $firstname = " "; var $middlename = " "; var $lastname = " "; function firstname() { echo "First Name : ". $this -> firstname; } function middlename() { if (middlename){ echo "Middle Name : ". $this -> middlename; else echo "Middle name, what is that? "; } } function lastname() { echo "Last Name : ". $this -> lastname; } } // b) function firstname2 extends firstname() { echo "First Name: ".$param; } // c) function lastname2 extends lastname() { echo "Last Name: ".$param; } // d) firstname(); …

Member Avatar
Member Avatar
+0 forum 10

I am in situation like I have a class which have two different subclasses. [CODE]public class SuperClass{ String st; public String getSt(){ return st; } } class A extends SuperClass{ } class B extends SuperClass{ } [/CODE] Now I have another method that want to access the getSt inherited method from A and B's object. Like I have a code like this in this method: [CODE] String s=objectOfA.getSt(); String s1=ObjectOfB.getSt(); [/CODE] I want to make this call generic, so in place of ObjectOfA,ObjectOfB I want to use something else so I can extend a single copy of this method in …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I'm almost done with a problem for a java class I'm taking. The chapter I'm studying is on inheritance and I think I understand it ok. The parent class will compile fine, but when the child class tries to compile I get an error saying it cannot find the constructor in the parent class. I am supposed to write an application that creates an object of each class, and demonstrate that all the methods work correctly. Take a look, any input would be VERY appreciated! Parent Class: [CODE] public class HotelRoom { double rentRate; int roomNum; public HotelRoom(int …

Member Avatar
Member Avatar
+0 forum 1

The End.