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 6132455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:06:16+00:00 2026-05-23T17:06:16+00:00

public void displayData(String [] names, int []scores, char [] grades){ for (String name :

  • 0
public void displayData(String [] names, int []scores, char [] grades){
        for (String name : names && char grade : grades)
            System.out.println(name + "\t");
            System.out.print(grade);

Above is my code. I need to put an and operator in the for loop but the code above is not correct. Please help. I will give additional details if needed.

  • 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-05-23T17:06:17+00:00Added an answer on May 23, 2026 at 5:06 pm

    Assuming all the arrays are parallel (all of the same length, with the value in the grades array at index i being the grade of the student in the names array at index i), you probably could just re-write the loop as:

    for (int i = 0; i < grades.length; ++i) {
      System.out.println(names[i] + "\t" + grades[i]);
    }
    

    Also, try to avoid multiple System.out.print statements one after another, as each requires a call to the operating system which slows your application down a bit, because the entire program much stop while the operating system handles your request to print the string. Concatenate (stick together with ‘+‘) strings where possible, instead.

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

Sidebar

Related Questions

public void Find() { String Value = ; System.out.println(Search Name); Value = Input.next(); int
E,g class Test { public: void setVal(const std::string& str) { this.isVal = str; //This
public class Main { public static void main(String[] args) { int[] x = {1,
public void test() { List<int> list = new List<int>(); list.Add(1); list.Add(2); list.Add(3); for (int
My Program overrides public void paint(Graphics g, int x, int y); in order to
In the following snippet: public class a { public void otherMethod(){} public void doStuff(String
public void RestoreDatabase(String databaseName, String filePath, String serverName, String userName, String password, String dataFilePath,
public class XXX { public static void main(String args[]) { JComponent comp = new
this: public void foo() { for (int i = 0; i < rows; i++)
public void turnRight() { int direction=getDirection(); if (direction==3) direction=0; else direction++; this.setDirection(direction); So I

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.