8 Topics
|
|
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 … |
|
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); } … |
|
[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 … |
|
[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(){ … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
The End.