Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:36:24+00:00 2026-06-14T14:36:24+00:00

package email; public class Test { public static void main(String[] args) { Email email

  • 0
package email;

public class Test {
  public static void main(String[] args) {
    Email email = new Email("833","388","How are you?");
    someMethod(email);
  }

  private static void someMethod(Email email) {
    System.out.println(email.trimLines());
  }
}

I have a question on displaying return value of a void type. So trimLines is a void type method. I don’t see how you can display a void type method because the method return nothing so there is nothing to display. Since println takes a string type this would cause an error.

I couldn’t find any method in System.out that would display a void type. This was specified in my assignment to display return value of the void method. I think my teacher made a mistake but may be there is something that will work with void type.

Can anyone confirm if my teacher made a mistake or is there a method that can display the void type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:36:25+00:00Added an answer on June 14, 2026 at 2:36 pm

    void means that the method returns nothing, not even null. So maybe there’s really an error in your assignment.

    We don’t know the implemenation of your EMail class. So trimlines() may affect the inner state of your email instance (“the mail body”). Maybe you have to call trimlines() first on the object and print the email in a second step.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

package org.study.algos; public class Study { public static void main(String[] args) { A a
package GC; import java.util.Scanner; public class main { public static void main(String args[]) {
package pack; public class sample{ public static void main(String input[]) { NumberFormat numberFormat =
package src; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Command { public static
package test; import java.awt.*; import java.awt.event.*; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; import javax.swing.*; public class
My custom type is (no default constructor!): package com.XXX.common; public class Email implements Serializable
package { import mx.controls.LinkButton; import flash.text.TextLineMetrics; public class multiLineLinkButton extends LinkButton { override protected
i have the following classes: //Product class public class Product { @Id @GeneratedValue private
I have this class: package com.problemio; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList;
Please have a look at the following code package normal; //This class if s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.