8 Topics

Member Avatar for
Member Avatar for Pyler

Hi I'm trying to write a toString() method for a generic LinkedStack but I'm having trouble My class has two push methods. One pushes elements of some type onto the stack. It takes in some generic element and pushes it onto the stack. The other method takes in some generic …

Member Avatar for Pyler
0
1K
Member Avatar for surajrai

Hi, I have seen in couple of places the code where ToString() method has been overriden. Like : class Employee : IComparable<Employee> { public int Salary { get; set; } public string Name { get; set; } public int CompareTo(Employee other) { if (this.Salary == other.Salary) { return this.Name.CompareTo(other.Name); } …

Member Avatar for darkagn
0
544
Member Avatar for rahul.ch

[code]public class StringBuilderConstructors { public static void main(String args[]) { StringBuilder sb3 = new StringBuilder("hello"); System.out.printf("buffer3 = %s\n", sb3.toString()); //written in textbook System.out.printf(sb3); //i tried System.out.println("buffer3=" + sb3); // i tried }} o/p: buffer3 = hello hello buffer3=hello[/code] doubt: The book says toString() gives the string representation an object. That …

Member Avatar for rahul.ch
0
234
Member Avatar for chiiqui

[CODE]public class Briefcase{ private int amount; private String face; private boolean isOpen = false; public Briefcase(int amount,int cNumber){ this.amount = amount; this.face = Integer.toString(cNumber); } public void removed(){ isOpen = true; face = "X"; } public boolean isRemoved(){ return isOpen; } public int getAmount(){ return amount; } public String toString(){ …

Member Avatar for stevanity
0
178
Member Avatar for fonzi

Hey all =] , I am having a few problems ending this coding homework and i would love if you could help me on how to solve this problem, well my problem is that i try to print the toStirng in my constructor class and for the months it prints …

Member Avatar for 115harman
0
147
Member Avatar for 24x24

My assignment: develop a limited application to track the statistics of sports players. For each player, track first and last name, points scored, assists made, and penalty rate. Design and implement an object capable of recording this info. Implement this object as Player. Must allow user to enter new player …

Member Avatar for yancouto
0
210
Member Avatar for fonzi

so i am working on a assigment for school, and i need help with the java.util.Calendar , i am trying to increment the year of as today by one each index of an array . This functions needs to be inside a toString(). so i need some help i know …

Member Avatar for fonzi
0
223
Member Avatar for Newskin01

There is a great deal of information out there on printing arrays in toString() but most suggest using Arrays.toString(arr); This however prints the whole array even the nulls and is formatted a specific way. I'm looking for a way to print the values in an array that are not null …

Member Avatar for jon.kiparsky
0
2K

The End.