Solved

How to implement the following code?

Posted on 2002-06-03
5
210 Views
Last Modified: 2010-03-31
I am new to JAVA And I need help with this piece of code..

I have a class-
CuLinePrinter

It has this method-
public void printText(java.lang.String s_text,
                      java.lang.String s_printer,
                      int i_num_copies)
               throws CuLinePrinterException

How do I use it inside a
Take.java class .. I want to implement it inside

the method called
public void sendEmail (sting mailto) throws EmailException{

  // how to create a new object for CuLinePrinter
  // how to initilize it and then use it..

..


}

Thanks



0
Comment
Question by:sdesar
  • 4
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 7052165
we'd have to see the constructor for CuLinePrinter class, but it probably has a zero argument constructor so:

public void sendEmail (sting mailto) throws EmailException{

 // how to create a new object for CuLinePrinter
 CuLinePrinter clp = new CuLinePrinter();
 clp.printText(...)

}

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7052166
i could post a better solution if you can post the code for CuLinePrinter class.
0
 

Author Comment

by:sdesar
ID: 7071143
I have another java related ques.. could u help me please?
here's the ques.

I have a String defined as -

String s_file = getfile();

I need to get the length of this s_file and if its
greater than 80 characters and split it into 2 strings and print it.

I used
int i_len = s_file.length();
and
if ( s_file != "" && i_len > 80)
{
   s_file = sfile,substring(0,80);
   String s_file2 = s_file.substring(80, i_len);

}

When I run it I get a StringIndexOut oF bounds Exception..

Any suggestions?
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 7071322
s_file = sfile,substring(0,80);
String s_file2 = s_file.substring(80);

or

s_file = sfile,substring(0,80);
String s_file2 = s_file.substring(80, i_len - 80);

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7071323
if that works for you, please don't forget to close out this question and accept an answer.

Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in @AspectJ Based AOP with Spring 2 23
spring jars download 1 52
jboss 7.1 start up error 1 60
Why doesn't this text field show up on my Applet frame? 2 28
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question