小编Cai*_*aik的帖子

我怎么能修复这个等于原始类型(int)

继承我的图书馆应用程序代码

package com.accenture.totalbeginner;

public class Person {
  private String name;
  private int maximumbooks;

  public Person() {
    name = "unknown name";
    maximumbooks = 3;
  }

  public    String getName() {
    return name;
  }

  public void setName(String anyname)   {
    name = anyname;
  }

  public int getMaximumbooks() {
    return maximumbooks;
  }

  public void setMaximumbooks(int maximumbooks) {
    this.maximumbooks = maximumbooks;
  }

  public String toString() {
    return this.getName() + " (" + this.getMaximumbooks()  + " books)";
  }

  public boolean equals(Person p1) {
    if(!this.getName().equals(p1.getName()))    {
        return false; …
Run Code Online (Sandbox Code Playgroud)

java eclipse methods

1
推荐指数
1
解决办法
1万
查看次数

我的循环在C中没有正常工作任何想法?

我是昨天的C新手,我正在尝试创建一个需要10个字符的循环,然后打印出其中有多少"a".无论字符串中有多少"a",它都打印出来0.任何帮助都会非常感激.

#include <stdio.h>
#include <string.h>

int main()
{
       char string[10];
   int c = 0;
   int loop = 0;

   printf("Enter a string\n");
   gets(string);


for (loop = 0; loop >10; ++loop)
 { 
    if (string[c] = 'a')
    {
     ++c;
    }
 }
      printf("A occurs %d times in the entered string.\n",c);

   return 0;
}
Run Code Online (Sandbox Code Playgroud)

c loops

-1
推荐指数
1
解决办法
81
查看次数

标签 统计

c ×1

eclipse ×1

java ×1

loops ×1

methods ×1